So, I cut out most of the script, but for some reason the script won't change the Player's team nor will it respawn the player.. Why?
local player = game.Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end
local gui = script.Parent:WaitForChild("IntroductionGui")
local menuMusic = gui:WaitForChild("MenuMusic")
local background = gui:WaitForChild("Background")
local logo = gui:WaitForChild("Logo")
local textFrame = gui:WaitForChild("Text")
local textOne = textFrame:WaitForChild("TextLabel1")
local textTwo = textFrame:WaitForChild("TextLabel2")
local ethicsCommitteeButton = gui:WaitForChild("EthicsCommitteeButton")
local dClassButton = gui:WaitForChild("DClassButton")
local intelligenceAgencyButton = gui:WaitForChild("IntelligenceAgencyButton")
local sciencetificDepartmentButton = gui:WaitForChild("ScientificDepartmentButton")
local foundationPersonnelButton = gui:WaitForChild("FoundationPersonnelButton")
local securityDepartmentButton = gui:WaitForChild("SecurityDepartmentButton")
local administrativeDepartmentButton = gui:WaitForChild("AdministrativeDepartmentButton")
local mobileTaskForceButton = gui:WaitForChild("MobileTaskForceButton")
local medicalDepartmentButton = gui:WaitForChild("MedicalDepartmentButton")
local chaosInsurgencyButton = gui:WaitForChild("ChaosInsurgencyButton")
local versionFrame = gui:WaitForChild("Version")
local errorNotificationFrame = gui:WaitForChild("ErrorNotification")
local errorText = errorNotificationFrame:WaitForChild("ErrorText")
local raidValue = game.Lighting:WaitForChild("RaidAuthorised")
local replicatedStorage = game:GetService("ReplicatedStorage")
local remote = replicatedStorage:WaitForChild("RemoteEventPlayerIntroductionManager")
--Data saving.
local chosen = false
if tostring(game.Players.LocalPlayer.Team) == "Pending" and player.Name ~= "Player1" then
dClassButton.TextButton2.MouseButton1Click:connect(function()
if chosen == false then
if character then
chosen = true
gui.GroupGranted:Play()
loadCharacterTransition()
remote:FireServer("ChangeTeam", player, "D Class Personnel")
remote:FireServer("LoadPlayer", player)
if character:FindFirstChild("ForceField") then
character["ForceField"]:Destroy()
end
end
end
end)
--- END OF SAME BUTTON
intelligenceAgencyButton.TextButton.MouseButton1Click:connect(function()
if player:IsInGroup(3131922) then
if chosen == false then
if character then
chosen = true
gui.GroupGranted:Play()
loadCharacterTransition()
remote:FireServer("ChangeTeam", player, "Intelligence Agency")
remote:FireServer("LoadPlayer", player)
if character:FindFirstChild("ForceField") then
character["ForceField"]:Destroy()
end
end
end
else

1 comment
In which line was the deprecated code in?