Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Radio Script: Now it started going over the max number, this isn't normal. Help again?

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 and Number ~= 101.0  then   
            Number = Number + 0.1
            textGui.Text = tostring(Number)
            print("work")
    elseif inst.KeyCode == Enum.KeyCode.Q and Number ~= 100.0 then
            Number = Number - 0.1
            textGui.Text = tostring(Number)
            print("work")
    end
end)

1 comment

0

Next time, don't make an entirely new question if it pertains to the same block of code, just update your original and work with the person who answered your question if you come across new errors in a solution that was provided.

1 answer

Reposting brr

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Number = script.Parent.Radio.Value
local textGui = script.Parent


local uis = game:GetService("UserInputService")
uis.InputEnded:Connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.E and Number < 101.1  then   
            Number = Number + 0.1
            textGui.Text = tostring(Number)
            print("work")
    elseif inst.KeyCode == Enum.KeyCode.Q and Number > 99.9 + 0.1 then -- without +0.1 it would be able to have a 99.8 value, don't think you want that
            Number = Number - 0.1
            textGui.Text = tostring(Number)
            print("work")
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.