Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local remoteEvent = Instance.new("RemoteEvent", game.Workspace)
- local serverFunctions = {}
- function serverFunctions.spawnCustom(player)
- print(player)
- game.Workspace:WaitForChild(player.Name)
- game.Workspace[player.Name]:WaitForChild("Humanoid")
- local OldCharacter = player.Character
- local OldCharacterLocation = OldCharacter.Torso.Position
- local NewCharacter = game.ServerStorage.NewCharacter:Clone()
- NewCharacter.Name = player.Name
- NewCharacter.Parent = game.Workspace
- local Humanoid = OldCharacter.Humanoid
- player.Character = NewCharacter
- Humanoid.Parent = NewCharacter
- Humanoid.PlatformStand = true
- OldCharacter:Destroy()
- local SpawnGui = player.PlayerGui:FindFirstChild("SpawnGui")
- if SpawnGui ~= nil then
- SpawnGui:Destroy()
- end
- NewCharacter:MoveTo(OldCharacterLocation)
- end
- function handleEvent(player, functionName, args)
- if serverFunctions[functionName] then
- serverFunctions[functionName](player, args)
- end
- end
- remoteEvent.OnServerEvent:connect(handleEvent)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement