Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I change a character like how they do in piggy with the equipping system?

Asked by 4 years ago
Edited 4 years ago

LocalScript: local services = {

["replicatedStorage"] = game:GetService("ReplicatedStorage")

}

local PlayerService = game:GetService("Players")

local player = PlayerService.LocalPlayer

local Q = Enum.KeyCode.Q

local UIS = game:GetService("UserInputService")

local event = services.replicatedStorage:WaitForChild("CharacterChange",2)

local character = services.replicatedStorage:WaitForChild("StarterCharacter",2)

UIS.InputBegan:Connect(function(key)

if key.KeyCode == Q and character then

    event:FireServer(player)

    character.Parent = game.StarterPlayer

    player.Character = game.StarterPlayer:WaitForChild("Character")

end

end)

Regular Script:

game.ReplicatedStorage.CharacterChange.OnServerEvent:Connect(function(player)

player:LoadCharacter()

end)

1 answer

Log in to vote
0
Answered by 3 years ago

If anyone has this problem, it's because you have to add the skin/character from the server. If you do it on the client(i.e LocalScript) then it won't change at all.

Ad

Answer this question