local player = script.Parent.Parent.Parent.Parent
for i, object in pairs(game.Workspace:GetChildren()) do
if player.Name == object.Name then
local char = object
local human = char:FindFirstChild("Humanoid")
local walkSpeed = human.WalkSpeed
if script.Parent.Visible == true then
walkSpeed = 0
end
end
end
✓ ANSWER ACCEPTED
I can't get the gui to disable the player's walkspeed while visible?
1 answer
✓ Accepted answer
When you make a variable equal to an object's property, the variable will become what the property equals, but it won't retain a reference to the object.
So if a part's Transparency is 1, t = part.Transparency will make t equal 1.
t, however, doesn't retain a reference to part, meaning that if I edit t later the transparency of the part won't change.
To fix this, just make your variable equal to the object, then edit its property.
if script.Parent.Visible == true then
human.WalkSpeed = 0
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you so much :D