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

How can I make my Local Player Script work?

Please tell me what is wrong with this script. I also want to know how to make the TextButton not visable.

function onClick()
    while true do
        game.Players.LocalPlayer.leaderstats.Score.Value = game.Players.LocalPlayer.leaderstats.Score.Value + 1
        
        local str =  game.Players.LocalPlayer.leaderstats.Score.Value
        local str1 = "Your income: "
        game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.TextLabel.Text = str1..str
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.TextButton.Visable = false      
wait(1)
    end
end

script.Parent.TextButton.MouseButton1Click:connect(onClick)

1 answer

There is this weird thing for local scripts, that you have to put wait(0.1) at beginning of the code. You might be able to use smaller wait time, but I haven't experimented with it too much, so I stick to using 0.1 seconds.

2 comments

0

Oh really? Okay.

0

Yeah, essentially it has something to do with script loading faster than GUI objects, so it errors. It's kind of silly.

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