-
Hello, I was creating a textbutton which should state in the text what’s the Humanoid Walkspeed.
-
Basically, my script is not working, below you can find what I used.
script.Parent.Text = game.Players.LocalPlayer:WaitForChild("Humanoid").WalkSpeed.
Hello, I was creating a textbutton which should state in the text what’s the Humanoid Walkspeed.
Basically, my script is not working, below you can find what I used.
script.Parent.Text = game.Players.LocalPlayer:WaitForChild("Humanoid").WalkSpeed.
What kind of script did you use?
Local script…*30)…
script.Parent.Text = game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed
You forgot about .Character and you also added an extra dot at the end.
It doesn’t continuosly updates, this means that if I touch a speed giver it won’t instantly update.
Because you’re only executing that line once;
Add an event to check for when the humanoid’s walkspeed is changed and then execute the line.
Could you read my DevForum DM?
What Adaptabil said.
local ScreenGUI = script.Parent
local TextLabel = ScreenGUI. TextLabel
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character
local humanoid = char:WaitForChild("Humanoid")
local WalkSpeed = humanoid.WalkSpeed
WalkSpeed.Changed:Connect(function(newvalue)
TextLabel.Text = newvalue
end)
I think you could make that a while true loop instead
That would not work.
WalkSpeed is a number, so doing WalkSpeed.Changed:... won’t work.
What you are looking for is :GetPropertyChangedSignal(Property).
To contribute to the topic:
I believe the button is in a ScreenGui with ResetOnSpawn with true, so this should work fine.
What this does is make usage of events, to ensure that a character exists, and to efficiently update the TextButton’s text when the WalkSpeed changes.
local TextButton = script.Parent
local Players = game:GetService("Players")
local Client = Players.LocalPlayer
local Character = Client.Character or Client.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
TextButton.Text = Humanoid.WalkSpeed
Humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
TextButton.Text = Humanoid.WalkSpeed
end)
no, i mean like
local Players = game:GetService("Players")
while true do
script.Parent.Text = game.Players.LocalPlayer:WaitForChild("Humanoid").Walkspeed
end
that’s a while true loop - it will go forever and should update as soon as the loop is over and starts running again. To the best of my knowledge.
You script will time out since you didn’t add a wait. Also, the first line is not necessary as you are already getting the players service from game.Players
while true do
wait(0.1)
script.Parent.Text = game.Players.LocalPlayer:WaitForChild("Humanoid").Walkspeed
end
Why make it update constantly when you can just make it update whenever it changes… makes more sense
Hi! I’m going to help you with this problem.
To begin with, let’s create ScreenGui into StarterGui. Let’s call it ‘Speed’.
Secondly, you will need to create TextLabel and put it into Speed. Let’s name it SpeedValue. In the SpeedValue we have to put a Script. Name it whatever you want. For this tutorial I choosed ‘ShowActualSpeed’ as a name.
Let’s open up a Script. The code should exactly look like this:
--Get player and his character.
local player = script.Parent.Parent.Parent.Parent
local character = player.Character
--Change the text to current player speed.
script.Parent.Parent.SpeedValue.Text = character.Humanoid.WalkSpeed
while true do --Change text every 5 second.
wait(5)
script.Parent.Parent.SpeedValue.Text = character.Humanoid.WalkSpeed
end
Here is how everything looks in the Explorer:

We can say that all is done. Every 5 seconds the current speed of the player updates. But if we would like a quick example of usage of this GUI. Here it is:
In ServerScriptService we create a Script that loades and saves player speed in DataStore.
Next we create a GUI with a TextButton that clicked will give our character his current speed + 1.
When our Script detects that the value of player Speed have changed we update text of the TextLabel that we created first.
Quick example of everything can be viewed here:
https://www.roblox.com/library/5280826816/Speed-Demo-v2
I hope that I helped. Please mark this as Solution and if you like, you can give my reply a
! Thanks!
Why use a loop when you can use a event specifically designed for you to detect when something changes?
This is also relevant: