I don’t understand this problem. Inside of an event in a server script, there is a variable called “move” that should be updated with the speed of a Humanoid.Running function. However, it does not update it outside of the function, always returning the value from before.
local hum = player.Character:FindFirstChildOfClass("Humanoid")
local move
hum.Running:Connect(function(speed) move = speed end)
print(move)
I checked some other posts but I don’t understand them (perhaps their problem isn’t similar to mine? not sure…). What am I doing wrong?
This is likely due to print firing before the signal itself is received. Connections are asynchronous meaning after defining them it won’t yield the rest of the script. Try printing it inside the hum.Running or use hum.Running:Wait() which will wait until it the signal is fired but this method won’t include the speed.