Is there a way to make a touched function so that it only fires if only a certain player touches it? I tried the following:
part.Touched:connect(function(hit) if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then if hit.Parent == [Playername goes here] then --Script here end end end)
but it doesn't work. Advice? I'm still new to this kind of stuff so uh yeah..
hit.Parent = What part of player touched
it must be:
part.Touched:connect(function(hit) if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) -- get player from character if plr and plr.Name == "Name Here" then --Script here end end end end)
i hope this works