local player = game.Players.LocalPlayer local mouse = player:GetMouse() local Number = game.StarterGui.ScreenGui.RadioNumb.Radio.Value local textGui = script.Parent local uis = game:GetService("UserInputService") uis.InputEnded:connect(function(inst) if inst.KeyCode == Enum.KeyCode.E then Number = Number + 1 textGui.Text = string(Number) print("work") end end) uis.InputEnded:connect(function(inst) if inst.KeyCode == Enum.KeyCode.Q then Number = Number - 1 textGui.Text = string(Number) print("work") end end)
I was trying to make a radio as a game, with music. I want it to work sorta like a radio. The gui thing looks like this
ScreenGui -> TextGui:RadioNumb -> IntValue:Radio, LocalScript:changeStation
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local Number = game.StarterGui.ScreenGui.RadioNumb.Radio.Value local textGui = script.Parent local uis = game:GetService("UserInputService") uis.InputEnded:Connect(function(inst) if inst.KeyCode == Enum.KeyCode.E then Number = Number + 1 textGui.Text = tostring(Number) print("work") elseif inst.KeyCode == Enum.KeyCode.Q then Number = Number - 1 textGui.Text = tostring(Number) print("work") end end)
tostring(), not string()
also change connect to Connect
and you can use elseif instead of two ifs