Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Self Solved Admin only speed not working. Any help? I accept answers!

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)

2 answers

✓ Accepted answer

It’s because

if hit.Parent == allowedPlayers then

Do

if hit.Parent.Name == allowedPlayers then

6 comments

0

you posted just as I figured it out lol

0

LOL, what timing thanks for the rep

0

LOL, what timing thanks for the rep

0

No problem also if I would like to add multiple names how would I go by doing that?

0

this is what I tried but it didn't work

0

("Yoricle".."M9F")

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.