local number=164
local TextButton=Instance.new("TextButton",Instance.new("ScreenGui",game.Players.LocalPlayer:WaitForChild("PlayerGui")))
TextButton.Text=number
local inputservice=game:GetService("UserInputService")
local wdown,sdown=false,false
inputservice.InputBegan:connect(function(input)
if input.KeyCode.Name=="W"then
wdown=true
while wdown do
wait(.1)
number=number+32
TextButton.Text=number
end
elseif input.KeyCode.Name=="S"then
sdown=true
while sdown do
wait(.1)
number=number-32
TextButton.Text=number
end
end
end)
inputservice.InputEnded:connect(function(input)
if input.KeyCode.Name=="W"then
wdown=false
elseif input.KeyCode.Name=="S"then
sdown=false
end
end)
`
It's designed to make a Text button display a number every time an s or w key is pressed, but I cannot make the script work with the button, can you help fix this?

1 comment
is this script a LocalScript