I’m trying to make script that prints his name and word if player failed to change his team using button. Heres the script:
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.Team = "Loading" then
print((plr.Name), "failed to change his team to Citizen")
end
end)
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.Team == "Loading" then
print((plr.Name), "failed to change his team to Citizen")
end
end)
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
if player.Team == "Loading" then
print(player.Name.." has failed to change his team to Citizen")
end
end)
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local notTeamColor = Color3.fromRGB(255,255,255)
if player.TeamColor == Color3.fromRGB(notTeamColor) then
print(player.Name.." has failed to change his team to Citizen")
end
end)
-- print script
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local notTeamColor = Color3.fromRGB(255,255,255)
if player.TeamColor == Color3.fromRGB(notTeamColor) then
print(player.Name.." has failed to change his team to Citizen")
end
end)
-- scripts in combine unit and citizen is same (LocalScript)
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemoteEvent:FireServer(script.Parent.Text) -- it changes player team and rank
game.Players.LocalPlayer.Character.Humanoid.Health = 0
end)
-- event script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, rank)
if typeof(rank) == "string" then
if rank == "Combine Unit" then
player.leaderstats.Rank.Value = "Recruit"
player.Team = game.Teams["Combine Unit"]
elseif rank == "Citizen" then
player.leaderstats.Rank.Value = "Citizen"
player.Team = game.Teams["Citizen"]
end
else
print("["..rank.."] Is not a String")
end
end)