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

None of the tool functions work?

Asked by 6 years ago
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?

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. 522049 152 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

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)
Ad
Log in to vote
0
Answered by 6 years ago

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.

0
Still refuses to work :/ nicktooner 119 — 6y

Answer this question