I was testing my game out and i found this error in the output. It broke a script of mine. What's wrong?
Script 1:
local timeToChange = script.Parent.timeToChange
local timeToChangeNoob = script.Parent.timeToChangeNoob
local timeToChangeGuest = script.Parent.timeToChangeGuest
local Deactivated = script.Parent.Deactivated
local RepStore = game:GetService("ReplicatedStorage")
function ManageGUIs()
for _, p in pairs (game.Players:GetChildren()) do
if p.Character ~= nil and p.Character.Humanoid ~= nil and p.Character.Humanoid.Health>0 and p.Character:findFirstChild("Torso") then
local torso = p.Character.Torso
if (torso.Position - script.Parent.Position).magnitude < 20 then
--Open Gui
RepStore.OpenCloseGUI:InvokeClient(p,script.Parent,true)
--Set GUI Spawn Team Color
RepStore.ModificateGUI:InvokeClient(p,"SpawnTeamColor",script.Parent.BrickColor.Color)
if not Deactivated.Value then
RepStore.ModificateGUI:InvokeClient(p,"Time",10-timeToChange.Value)
RepStore.ModificateGUI:InvokeClient(p,"ProgressBarColor",script.Parent.BrickColor.Color)
else
if timeToChangeNoob.Value>timeToChangeGuest.Value then
RepStore.ModificateGUI:InvokeClient(p,"ProgressBarColor",Color3.new(1,1,0))
RepStore.ModificateGUI:InvokeClient(p,"Time",timeToChangeNoob.Value)
else
RepStore.ModificateGUI:InvokeClient(p,"ProgressBarColor",Color3.new(0,0,0))
RepStore.ModificateGUI:InvokeClient(p,"Time",timeToChangeGuest.Value)
end
end
elseif RepStore.ModificateGUI:InvokeClient(p,"CheckSpawn") == script.Parent then -- >>ERROR<<
RepStore.OpenCloseGUI:InvokeClient(p,nil,false)
end
else
RepStore.OpenCloseGUI:InvokeClient(p,nil,false)
end
end
end
while wait(0) do
ManageGUIs()
end
Script 2 (The one that receives the InvokeClient(p,"CheckSpawn"))
wait(1)
local RepStore = game:GetService("ReplicatedStorage")
local spawnTeamColor = script.Parent.Frame.SpawnLocationImage.TeamColor
local Time = script.Parent.Frame.UnderProgressBar.ProgressBar.LocalScript.Time
local ProgressBar = script.Parent.Frame.UnderProgressBar.ProgressBar
local Spawn = script.SpawnPoint
function OpenGUI(spawn,canOpen)
if canOpen and Spawn.Value ~= nil then
script.Parent.Frame:TweenPosition(UDim2.new(1,-220,1,-70),"Out","Bounce",0.5,true)
else
script.Parent.Frame:TweenPosition(UDim2.new(1,80,1,-70),"Out","Bounce",0.5,true)
end
end
function ModificateGUI(WTM, value1)
if WTM == "SpawnTeamColor" then
if value1 == BrickColor.new("New Yeller").Color then
spawnTeamColor.BackgroundColor3 = value1
spawnTeamColor.BorderColor3 = Color3.new(1,0.67,0)
script.Parent.Frame.BackgroundColor3 = Color3.new(1,0.67,0)
elseif value1 == BrickColor.new("Mid gray").Color then
spawnTeamColor.BackgroundColor3 = value1
spawnTeamColor.BorderColor3 = Color3.new(0.5,0.5,0.5)
script.Parent.Frame.BackgroundColor3 = Color3.new(0.5,0.5,0.5)
elseif value1 == BrickColor.new("Really black").Color then
spawnTeamColor.BackgroundColor3 = value1
spawnTeamColor.BorderColor3 = Color3.new(0.25,0.25,0.25)
script.Parent.Frame.BackgroundColor3 = Color3.new(0.25,0.25,0.25)
end
elseif WTM == "Time" then
Time.Value = value1
elseif WTM == "ProgressBarColor" then
ProgressBar.BackgroundColor3 = value1
elseif WTM == "CheckSpawn" then
return Spawn.Value
end
end
RepStore.OpenCloseGUI.OnClientInvoke = function(spawn,canOpen)
Spawn.Value = spawn
OpenGUI(spawn,canOpen)
end
RepStore.ModificateGUI.OnClientInvoke = function(whatToModificate,value1)
local fun = ModificateGUI(whatToModificate,value1)
if fun ~= nil then
return fun
end
end
