Answered by
7 years ago Edited 7 years ago
Try this, this happened to me while making a gui for my place, I'm pretty sure it's because the script gets the sp value when it fires, and doesn't re-check when it changes, the solution was adding an extra function to detect when the value changes and update the text.
01 | local plr = game.Players.LocalPlayer |
02 | local sp = Instance.new( "IntValue" ) |
04 | plr.PlayerGui.MainUI.Display.SprintPower.Text = "Sprint Power: " ..sp.Value |
09 | function onKeyPress(inputObject, gameProcessedEvent) |
10 | if inputObject.KeyCode = = Enum.KeyCode.R then |
11 | local character = plr.Character |
13 | local hum = character:WaitForChild "Humanoid" |
26 | plr.Character.Humanoid.WalkSpeed = 16 |
31 | game:GetService( "UserInputService" ).InputBegan:connect(onKeyPress) |
32 | function onKeyPressEnd(inputObject, gameProcessedEvent) |
33 | local character = plr.Character |
35 | local hum = character:WaitForChild "Humanoid" |
47 | game:GetService( "UserInputService" ).InputEnded:connect(onKeyPressEnd) |
49 | sp.Changed:connect( function (NewValue) |
50 | plr.PlayerGui.MainUI.Display.SprintPower.Text = "Sprint Power: " ..sp.Value |