In this script I am trying to print the walkspeed of a player when they step on a part. The issue is, when I do my While True Do loop, the value printed doesnt change, just stays at 16 even though im still moving/slowing donw, and I dont know why. I’ve changed my script a few times, incliding making a variable for the walkspeed “Variablespeed”. Thank you in advance if you know the issue.
local Parent = script.Parent
local debounce = false
Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if debounce == false then
debounce = true
local player = hit.Parent
local variablespeed = player.Humanoid.WalkSpeed
while true do
wait(0.1)
print(variablespeed)
end
wait(60)
debounce = false
end
end
end)