Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
M9F 94
3 years ago
Edited 3 years ago

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

Log in to vote
1
Answered by
Nozazxe 107
3 years ago

It’s because

if hit.Parent == allowedPlayers then

Do

if hit.Parent.Name == allowedPlayers then
0
you posted just as I figured it out lol M9F 94 — 3y
0
LOL, what timing thanks for the rep Nozazxe 107 — 3y
0
LOL, what timing thanks for the rep Nozazxe 107 — 3y
0
No problem also if I would like to add multiple names how would I go by doing that? M9F 94 — 3y
View all comments (2 more)
0
this is what I tried but it didn't work M9F 94 — 3y
0
("Yoricle".."M9F") M9F 94 — 3y
Ad
Log in to vote
0
Answered by
M9F 94
3 years ago
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)

Answer this question