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

How could I make a part when touched, gives points to the opposite team?

Asked by
DesertusX 435 Moderation Voter
5 years ago
Edited 5 years ago

I am trying to make a part that when touched, adds to the value of the opposing team's points. I have already tried making a script on this, but it didn't seem to work when I test played the game. Can someone please help fix my script or make a new script? I would be very grateful. The script is the following:

01local p = script.Parent
02local vr = game.StarterGui.ScreenGui.Frame.AwayPlayer.AwayPlayerScore.RedValue.Value
03local vb = game.StarterGui.ScreenGui.Frame.HomePlayer.HomePlayerScore.BlueValue.Value
04p.Touched:Connect(function(hit)
05    if hit.Parent:FindFirstChild("Humanoid")then
06        if hit.Parent.TeamColor3 = "Bright blue"then
07            vr = vr+1
08            elseif hit.Parent.TeamColor3 = "Bright red"then
09                vb = vb+1
10            end
11        end
12    end)

Thank you for trying to help. I really appreciate it.

0
Use code blocks for scripts Claverbot 4 — 5y
0
Thank you. I am still new to this website. DesertusX 435 — 5y

Answer this question