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
4 years ago
Edited 4 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:

local p = script.Parent
local vr = game.StarterGui.ScreenGui.Frame.AwayPlayer.AwayPlayerScore.RedValue.Value
local vb = game.StarterGui.ScreenGui.Frame.HomePlayer.HomePlayerScore.BlueValue.Value
p.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid")then
        if hit.Parent.TeamColor3 = "Bright blue"then
            vr = vr+1
            elseif hit.Parent.TeamColor3 = "Bright red"then
                vb = vb+1
            end
        end
    end)

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

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

Answer this question