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

Can someone please fix this GUI script?

I'm trying to make a basic counting script. What is wrong with this?

function Touched(SoccerBall)
	Workspace.ScoreBoard.Score1.Frame.RedScore.Text = 1
	if Workspace.ScoreBoard.Score1.Frame.RedScore.Text == 1 then
		Workspace.ScoreBoard.Score1.Frame.RedScore.Text = 2
	end
end

script.Parent.Touched:connect(Touched)

1 answer

Well first off, you dont actually have a counter, you're just changing the text to 2 each time after it gets past one.

goals = 0 --Starting number of goals
script.Parent.Touched:connect(function(SoccerBall)--firing the event
	goals = goals + 1
	Workspace.ScoreBoard.Score1.Frame.RedScore.Text = goals
end)

3 comments

0

Yea I don't have a vast range of scripting knowledge so I just went to the basics. Thank you!

0

No problem, be sure to accept the answers so that people know it's completed. :)

0

I recommend adding a line to see if it's name is Soccer ball. With this script, anybody could run into the goal and they'd get a point.

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