Character doesnt spawn when gui button is clicked

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Spawn character when gui button is clicked

  2. What is the issue? Include screenshots / videos if possible!
    The player doesnt spawn when gui button is clicked it only makes the camera custom

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I only found this scripts here but they didnt work as I wanted to

This for the server

game.Players.CharacterAutoLoads = false 

game.Players.PlayerAdded:Connect(function(Player)
	Player:LoadCharacter()
	repeat wait() until Player.Character:FindFirstChild("Humanoid") -- Loaded Character Humanoid
	Player.Character.Parent = game.ServerStorage -- Store It
end)

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player)
	repeat wait() until game.ServerStorage:FindFirstChild(Player.Character.Name)
	game.ServerStorage:FindFirstChild(Player.Character.Name).Parent = game.Workspace
	print("LoadedCharacter")
end)

This for the client

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera

local PlayButton = script.Parent.Play

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart.CFrame

PlayButton.MouseButton1Click:Connect(function()
	Camera.CameraType = Enum.CameraType.Custom
	PlayButton:Destroy()
    game.ReplicatedStorage.RemoteEvent:FireServer()
end)

Heres a video too of whats the problem

1 Like

found the solution basically delete Part from CameraPart in the client script, so the client script should be this

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local PlayButton = script.Parent.SkipButton3

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.Camera.CFrame

PlayButton.MouseButton1Click:Connect(function()
	Camera.CameraType = Enum.CameraType.Custom
	PlayButton:Destroy()
	game.ReplicatedStorage.RemoteEvent:FireServer()
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.