Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
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)
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. SteamG00B 1633 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)
Ad

Answer this question