Hey everybody, I’m having an issue with my characterscripts. I’m using a custom spawning system, where every time the player sends a request through a RemoteEvent, player:LoadCharacter() gets called on the server and the player respawns. However, due to this, none of my characterscripts seem to be running.
I tried putting a basic character script with only:
print("Running")
and it’s not printing. Nothing’s working. However, when I use regular character spawning, everything seems to work fine.
Here’s the character spawning script
-- davidslevs
-- This script handles deploying characters
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DeployRequestEvent = ReplicatedStorage.Remotes.DeployRequest
Players.CharacterAutoLoads = true
-- Clean up the character when it dies
Players.PlayerAdded:Connect(function(Player)
Player:SetAttribute("CanDeploy", true)
Player.CharacterAdded:Connect(function(Character)
Player:SetAttribute("CanDeploy", false)
Character.Parent = workspace
Character:WaitForChild("Humanoid").Died:Connect(function()
task.wait(Players.RespawnTime)
Player:SetAttribute("CanDeploy", true)
end)
end)
end)
DeployRequestEvent.OnServerEvent:Connect(function(Player)
-- Don't respawn if the dude is already in the game
if Player:GetAttribute("CanDeploy") == false then return end
Player:LoadCharacter()
end)