-
What do you want to achieve? Keep it simple and clear!
I am trying to make a player spawn with a custom avatar after a button is clicked. -
What is the issue? Include screenshots / videos if possible!
Everything works except the player does not spawn. I have done this same thing before and it worked. now it doesn’t.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I looked through all my code and looked through my older code to find what went wrong but I can’t find anything!
local script in my Gui.
local T = script.Parent.T
local S = script.Parent.S
local Sn = script.Parent.Sn
local plr = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local X = game.ReplicatedStorage.X
local B = game.ReplicatedStorage.B
local Y = game.ReplicatedStorage.Y
local Dead = false
T.MouseButton1Click:Connect(function()
X:FireServer()
script.Parent.Visible = false
print("pressed")
end)
S.MouseButton1Click:Connect(function()
B:FireServer()
script.Parent.Visible = false
end)
Sn.MouseButton1Click:Connect(function()
Y:FireServer()
script.Parent.Visible = false
end)
Server script to spawn the players.
local X = game.ReplicatedStorage.X
local B = game.ReplicatedStorage.B
local Y = game.ReplicatedStorage.Y
game.Players.PlayerAdded:Connect(function(player)
X.OnServerEvent:Connect(function()
if player.TeamColor == BrickColor.new("Earth green") then
print("past team color testing")
player:LoadCharacter()
player.Character.Animate.Parent = game.ReplicatedStorage.G
local character = game.ReplicatedStorage.G
local characterClone = character:Clone()
characterClone.Name = player.Name
characterClone:MakeJoints()
player.Character = characterClone
print("loaded!")
elseif player.TeamColor == BrickColor.new("Bronze") then
player:LoadCharacter()
player.Character.Animate.Parent = game.ReplicatedStorage.T
local character = game.ReplicatedStorage.T
local characterClone = character:Clone()
characterClone.Name = player.Name
characterClone:MakeJoints()
player.Character = characterClone
end
game.ReplicatedStorage.AR.Parent = player.Backpack
end)
end)
game.Players.PlayerAdded:Connect(function(player)
B.OnServerEvent:Connect(function()
if player.TeamColor == BrickColor.new("Earth green") then
player:LoadCharacter()
player.Character.Animate.Parent = game.ReplicatedStorage.G
local character = game.ReplicatedStorage.G
local characterClone = character:Clone()
characterClone.Name = player.Name
characterClone:MakeJoints()
player.Character = characterClone
elseif player.TeamColor == BrickColor.new("Bronze") then
player:LoadCharacter()
player.Character.Animate.Parent = game.ReplicatedStorage.T
local character = game.ReplicatedStorage.T
local characterClone = character:Clone()
characterClone.Name = player.Name
characterClone:MakeJoints()
player.Character = characterClone
end
game.ReplicatedStorage["Rocket Launcher"].Parent = player.Backpack
end)
end)
game.Players.PlayerAdded:Connect(function(player)
Y.OnServerEvent:Connect(function()
if player.TeamColor == BrickColor.new("Earth green") then
player:LoadCharacter()
player.Character.Animate.Parent = game.ReplicatedStorage.G
local character = game.ReplicatedStorage.G
local characterClone = character:Clone()
characterClone.Name = player.Name
characterClone:MakeJoints()
player.Character = characterClone
elseif player.TeamColor == BrickColor.new("Bronze") then
player:LoadCharacter()
player.Character.Animate.Parent = game.ReplicatedStorage.T
local character = game.ReplicatedStorage.T
local characterClone = character:Clone()
characterClone.Name = player.Name
characterClone:MakeJoints()
player.Character = characterClone
end
game.ReplicatedStorage.Sniper.Parent = player.Backpack
end)
end)