This script is supposed to give a team points every second for holding down a certain point. The "Owner" value (an ObjectValue) is nil until someone claims it, and that one person's name becomes the value of the "Owner" value.
The script is then supposed to find the team of the "Owner" and give his/her team points every second.
However, the script doesn't work. I received output, however.
Output: 12:35:50.999 - Argument 1 missing or nil 12:35:51.000 - Script 'Workspace.Map.KotH.PointGiver', Line 15
Script:
local DD = game.ServerScriptService.MainGameScript.Variables:WaitForChild("DD")
local GG = game.ServerScriptService.MainGameScript.Variables:WaitForChild("GG")
local BB = game.ServerScriptService.MainGameScript.Variables:WaitForChild("BB")
local RR = game.ServerScriptService.MainGameScript.Variables:WaitForChild("RR")
repeat
wait()
until script.Parent:findFirstChild("Owner")
while true do
local Dude = game.Players:FindFirstChild(script.Parent.Owner.Value)
if game.ServerScriptService.MainGameScript.Variables.Playing.Value == true then
if game.ServerScriptService.MainGameScript.Variables.GameMode.Value == "King of the Hill" then
if Dude ~= nil then
if Dude.TeamColor == BrickColor.new("Bright green") then
GG.Value = GG.Value + 1
elseif Dude.TeamColor == BrickColor.new("Bright red") then
RR.Value = RR.Value + 1
elseif Dude.TeamColor == BrickColor.new("Bright blue") then
BB.Value = BB.Value + 1
elseif Dude.TeamColor == BrickColor.new("Bright yellow") then
DD.Value = DD.Value + 1
end
end
end
end
wait(1)
end
