So I'm testing out a script that is only supposed to give a player speed if their name is in the code. I've never messed with any code like this and I've had a few attempts with no luck. Any help would be awesome!
local object = script.Parent local player = workspace local allowedPlayers = {"M9F"} local function giveSpeed(hit) if hit.Parent:FindFirstChild("Humanoid")then if hit.Parent == allowedPlayers then print("hi") hit.Parent.Humanoid.WalkSpeed = 50 end end end object.Touched:Connect(giveSpeed)
It’s because
if hit.Parent == allowedPlayers then
Do
if hit.Parent.Name == allowedPlayers then
local object = script.Parent local player = workspace local allowedPlayers = ("M9F") local function giveSpeed(hit) if hit.Parent:FindFirstChild("Humanoid")then if hit.Parent.Name == allowedPlayers then print("hi") hit.Parent.Humanoid.WalkSpeed = 50 end end end object.Touched:Connect(giveSpeed)