Hello! I’ve been writing a system where a player enters a trigger, gets a GUI asking who to play as, and it works just fine. I’ve only implemented two. I can switch between them only once, and then it seems that the character model isn’t treated as a player, as the player literally moves to the part I wanted to move them to, rather than just teleporting there, then respawns after a few seconds.
Here’s my code:
--SET CHARACTER SERVERSCRIPT
local CHANGERE = game.ReplicatedStorage.Events.change_SB
FishingGear = game.ReplicatedStorage.SB:Clone()
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
CHANGERE.OnServerEvent:Connect(function()
Player.Character = FishingGear
FishingGear.Parent = game.Workspace
FishingGear:MoveTo(_G.GoTo.Position)
end)
end)
end)
--GUI CLICK SCRIPT
local Player = game:GetService("Players")
local LocalPlayer = Player.LocalPlayer
local Character = LocalPlayer.Character
FishingGear = game.ReplicatedStorage.JFisher
local CHANGERE = game.ReplicatedStorage.Events.change_SB
function CostumePicked()
print("Picked", script.Parent.Text)
script.Parent.Parent.Parent.Enabled = false
Character.CurrentCostume.Value = "SquarePants"
CHANGERE:FireServer()
end
script.Parent.MouseButton1Click:Connect(CostumePicked)