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

There seems to be an error somewhere but im not sure where?

Asked by 8 years ago

Filipalla helped me test my game but he found an error and not sure how to fix it.

    script.Value.Changed:connect(function()
    if script.Value.Value > 100 then
        script.Value.Value = 100
    end
    end)
while true do
    wait(0.05)
    game.Players.LocalPlayer.PlayerGui.ScreenGui.MTC.Text = script.Value.Value
end

2 answers

Log in to vote
1
Answered by
Master_JJ 229 Moderation Voter
8 years ago

Why do you have script.Value? there is not a value property of the script.

If you have a variable named 'script', change it because you cannot use key words as variable names.

I also notice you used the Changed event on an property, instead of the instance.

local value = game.Workspace.Value -- where ever the value is

value.Changed:connect(function() -- not value.Value.Changed
    if value.Value > 100 then
        value.Value = 100
    end
end)

while true do
    wait(0.05)
    game.Players.LocalPlayer.ScreenGui.MTC.Text = tostring(value.Value)
end

Also make sure you're running this in a local script.

0
Also, all tostring does it turn a number into a word(string). Master_JJ 229 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

"script.Value.Value"

Something is wrong here, you can have a value of a value

0
scripts dont have a Value either IcedVapour 153 — 8y

Answer this question