#How Can I Improve this script 📝

1 messages · Page 1 of 1 (latest)

tawdry jasper
#

so basically this script works right but it doesnt always fire the touch event and it doesnt work sometimes im wondering how can I fix that issue: ‘’’local Folder = game.Workspace:WaitForChild("NpcShortCuts")
local player = game.Players.LocalPlayer
for i, Parts in pairs(Folder:GetChildren()) do
if Parts:IsA("Part") or Parts:IsA("TrussPart") then
Parts.Touched:Connect(function(hit)
if hit.Parent.Name ~= "Rig_"..player.UserId then
Parts.CanCollide = false
end
end)
end
end’’’

#

also this script is run by a local script

tawdry jasper
#

@silk trench

silk trench
#

bro WHO are you\

#

It looks fine, you don't rlly need to do much

#

I would personally lower the amount of scopes

tawdry jasper
tawdry jasper
silk trench
#

if hit.Parent.Name ~= "Rig_"..player.UserId then
Parts.CanCollide = false
end

#

Are you checking if someone is named that or isn't named that

tawdry jasper
#

the player should not be able to walk on the part

#

but the Rig can

tawdry jasper
#

Its basically how the touch evenr is firing

#

You have any tips to fix it? @silk trench

silk trench
#

not rlly tbh

tawdry jasper
turbid scroll
silk trench
tawdry jasper
silk trench
#

Nothing is technically reliable on the client

tawdry jasper
silk trench
#

Give me a sec

#

Ok the problem you could be facing is not all parts are loaded when that script loads

tawdry jasper
#

so how would I fix it

drowsy saffron
tawdry jasper
drowsy saffron
#

Format your code