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

How do I make the score on a scoreboard go up when the puck hits the sensor?

Asked by 4 years ago

local name = "ball" -- ENTER NAME OF BALL/PUCK THAT WILL TRIGGER A GOAL local showGoalMessage = false local playGoalHorn = true

local hornId = "rbxassetid://345231655"

local debounce = false

script.Parent.Touched:connect(function(hit) if hit.Name == name and debounce == false then debounce = true if showGoalMessage == true then local msg = Instance.new("Message", workspace) msg.Text = "Goal!" end if playGoalHorn == true then script.Horn.SoundId = hornId script.Horn:Play() wait (10) script.Horn:Stop() end game.Workspace.GameValues.HomeScore.Value = game.Workspace.GameValues.HomeScore.Value + 1 wait(5)

end end)

0
maybe at the second to last line do game.Workspace.GameValues.HomeScore.Value = Value + 1 wait(5)? btw use a code block so its easier to read sean_thecoolman 189 — 4y
0
What's a codeblock? Patriq_Kane 8 — 4y
0
Press the lua button and put the code inbetween the stuff that shows up User#28794 0 — 4y

Answer this question