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

StarterCharacter for a specific user?

Asked by 2 years ago

So I have a question, I am trying to make a StarterCharacter that only I can have in my game that I'm working on, I have gotten it to work using this code below, but the problem is that when anyone in my game resets, they will respawn as my character model as well, is there anyway around this? and if so can they help me by sharing the code as I am really new to this. Thank you! Here is my code in ServerScriptService at the moment:

local Avatar = game:GetService("ReplicatedStorage"):FindFirstChild("Jotaro").StarterCharacter

game.Players.PlayerAdded:Connect(function(player) if player.Name == 339048720 then local PlayerAvatar = Avatar:Clone() PlayerAvatar.Parent = game:GetService("StarterPlayer") PlayerAvatar.Name = "StarterCharacter" wait(0.1) Player:LoadCharacter() end end)

0
Yes it does have a JoJo character but its only to test the script and I used him because I am a fan 5tchimski 0 — 2y
0
btw remember to put your code in a codeblock NGC4637 602 — 2y

1 answer

Log in to vote
0
Answered by
NGC4637 602 Moderation Voter
2 years ago

just do it in a local script

so in StarterPlayerScripts, put this:

local Avatar = game:GetService("ReplicatedStorage"):WaitForChild("Jotaro"):WaitForChild("StarterCharacter")
local plr = game:GetService("Players").LocalPlayer

if plr.UserId == 339048720 then
    local clone = Avatar:Clone()
    clone.Parent = game:GetService("StarterPlayer")
    task.wait(0.03)
    plr:LoadCharacter()
end
0
When I do this nothing happens, I just spawn in as my regular self still 5tchimski 0 — 2y
Ad

Answer this question