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’’’
#How Can I Improve this script 📝
1 messages · Page 1 of 1 (latest)
@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
u helped me last time
its just that it doesnt work sometimes i dont know how to fix it
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
basically i havs a npc cloner that clones the player its named “Rig_”.. player.UserId” so what its doing is if its not named that then the part can be unwalkable
the player should not be able to walk on the part
but the Rig can
but the issue is, is that it sometimes work like sometimes the script actually works but on some other parts it doesnt work and im able to walk on it so i dont know how to fix it
Its basically how the touch evenr is firing
You have any tips to fix it? @silk trench
not rlly tbh
should i use run service or no
def not.
Do you need a loop?
no Its just that touched isnt reliable on local scripts so i want to make sure it works
Nothing is technically reliable on the client
so what should i do
Give me a sec
Ok the problem you could be facing is not all parts are loaded when that script loads
that could be true since only some parts are cancolideable and some i can walk on it
so how would I fix it
huh?
Format your code