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

None of the tool functions work?

Plr = game.Players.LocalPlayer
humanoid = Plr.Character.Humanoid.WalkSpeed
Tool = script.Parent

Tool.Activated:connect(function(mouse)
    humanoid = 100
end)

None of the tool functions work at all, am I over thinking this?

1 comment

0

Looks like a basic mistake; redefine humanoid in line 2 to humanoid = Plr.Character.Humanoid, then in line 6 change to humanoid.WalkSpeed = 100. Your mistake was changing the variable representation of humanoid and not changing the walkspeed of the actual humanoid.

2 answers

✓ Accepted answer

the "game.player" and the character are not created the same time

Plr = game.Players.LocalPlayer
char = Plr.Character
Tool = script.Parent
repeat wait() until char:FindFirstChild("Humanoid");
humanoid = char.Humanoid
Tool.Activated:connect(function(mouse)
    humanoid.WalkSpeed = 100
end)

The activated event doesn't take nor return anything. Also WalkSpeed isn't a object, but an integer so the variable humanoid is just whatever the characters current WalkSpeed is.

--LocalScript
local ply = game.Players.LocalPlayer
local cha = ply.Character
local hum = cha:WaitForChild("Humanoid")

script.Parent.Activated:connect(function()
	hum.WalkSpeed = 100
end)

If you need to see what parameters an event or function takes or object they return then just go to the View tab in Studio and select ObjectBrowser then search whichever class the function or event is in.

1 comment

0

Still refuses to work :/

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