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.

2 comments

0

Use code blocks for scripts

0

Thank you. I am still new to this website.