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

guiText.Text = " Points: " ..points.Value Why won't this line work for me?

Asked by 6 years ago
guiText = game.StarterGui.PointDisplay.BackGround.TextLabel
box = script.Parent.Box
points = game.StarterPack.Points
function onClick()
    box.Transparency = 1
    box.CanCollide = false
    points.Value = points.Value + 1
    guiText.Text = "  Points: " ..points.Value
    box:Destroy()
end
box.ClickDetector.MouseClick:connect(onClick)

I was trying to make some sort of point system on Roblox but line 8(guiText.Text = " Points: " ..points.Value)won't run. My gui won't change at all. There are no errors in the output(Probably a small detail I didn't see). Is there a way I can make this work?

1 answer

Log in to vote
0
Answered by 6 years ago

If the script is in the StarterGui, you can try this:

guiText = script.Parent.PointDisplay.BackGround.TextLabel

instead of:

guiText = game.StarterGui.PointDisplay.BackGround.TextLabel

You cannot do "game.StarterGui" because each Player has their own GUI, so: game.Players.PlayerGui

0
Oh ok thanks a lot. minblox0567 2 — 6y
0
It's game.Players.LocalPlayer.PlayerGui nooneisback 81 — 6y
Ad

Answer this question