Basically I'm trying to make a drink that dose a animation and a sound effect and each time you drink it it makes your speed go up a tiny bit. When I try to run this code I get this error: attempt to index upvalue 'Humanoid' (a nil value) Please help me fix it here is the code:
local Tool = script.Parent;
local Humanoid = script.Parent:FindFirstChild("Humanoid")
enabled = true
function onActivated()
if not enabled then
return
end
enabled = false
Tool.GripForward = Vector3.new(-0, -0.836, -0.549)
Tool.GripPos = Vector3.new(1.4, -0.4, 0.3)
Tool.GripRight = Vector3.new(0.996, -0.0509, 0.0776)
Tool.GripUp = Vector3.new(0.0928, 0.547, -0.832)
Tool.Handle.DrinkSound:Play()
wait(3)
Tool.GripForward = Vector3.new(-.976,0,-0.217)
Tool.GripPos = Vector3.new(0.2,-.1,0)
Tool.GripRight = Vector3.new(.217,0,-.976)
Tool.GripUp = Vector3.new(0,1,0)
wait(.5)
Humanoid.WalkSpeed = Humanoid.WalkSpeed +.5
wait(5)
enabled = true
end
script.Parent.Activated:connect(onActivated)

5 comments
Humanoid won't be a value of the tool, you need to do Tool.Parent:FindFirstChild("Humanoid"), or script.Parent.Parent:FindFirstChild("Humanoid")
I have changed it. No change. How about you give me a script.
That's not how this works, I'll fix it, but just keep in mind not to ask for the script, this is for help, not giving sciripts.
Auchally. This is how it works. You put a script and ask someone to help you fix it. By telling me the problem thats not really helping me how to fix it if I don't know how too.
Add wait() on top of the script.