This is going to be a little hard to explain so I’ll try my best. I’m making a ready up script. So far I’ve separated both players (of the two player game) into two teams and I’m using that to separate the two players for ease of scripting. Both players have the same scripts and the scripts just change what they do based on the TeamColor.
Here’s the problem area:
script.Parent.MouseButton1Up:Connect(function()
print(script.Parent.Parent.Parent.Parent.TeamColor)
if script.Parent.Parent.Parent.Parent.TeamColor == "Medium stone grey" then
It prints the right TeamColor:
However the script acts as if the if statement was failed when it should be passed (As shown by the print.)
Here are the other resources if needed.
Full script here
script.Parent.MouseButton1Up:Connect(function()
print(script.Parent.Parent.Parent.Parent.TeamColor)
if script.Parent.Parent.Parent.Parent.TeamColor == "Medium stone grey" then
if game.ServerStorage.PLR1READY.Value == true then
game.ServerStorage.PLR1READY.Value = false
script.Parent.Text = "READY UP"
print("PLR1 NOT READY")
else
game.ServerStorage.PLR1READY.Value = true
script.Parent.Text = "UNREADY"
print("PLR1 READY")
end
end
if script.Parent.Parent.Parent.Parent.TeamColor == "Black" then
if game.ServerStorage.PLR2READY.Value == true then
game.ServerStorage.PLR2READY.Value = false
script.Parent.Text = "READY UP"
print("PLR2 NOT READY")
else
game.ServerStorage.PLR2READY.Value = true
script.Parent.Text = "UNREADY"
print("PLR2 READY")
end
end
if game.ServerStorage.PLR1READY.Value == true and game.ServerStorage.PLR2READY.Value == true then
for i,v in pairs(game:GetDescendants("Players")) do
if v.Name == "Starter" then
v:Destroy()
end
end
end
end)
Explorer will all relevant information
What is happening here?