If it’s a direct child of ServerStorage (not in a folder, for example), then try what @sonicfoo3 posted in his latest reply. But change modelname to the name of your character. If I’m correct, WaitForChild isn’t necessary in server scripts for referencing objects created in studio.
Alright, I tried it and this is what happened
Maybe add some Instance called “IsCustom” to your custom character and then use this.
local Players = game:GetService("Players")
local ID = -- the userid id of your friend
local customChar = -- the character
Players.PlayerAdded:Connect(function(plr)
if plr.UserId == ID then
plr.CharacterAdded:Connect(function(char)
if not char:FindFirstChild("IsCustom") then
local newChar = customChar:Clone()
newChar.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame
plr.Character = newChar
newChar.Parent = workspace
end
end)
end
end
If I’m correct in saying, should the newchar.Parent = workspace
be newchar.Parent = plr
?
What is an instance? I am so very sorry, I am quite new.
An instance, is how you create something from within a script. For example, if I wanted to create a part in a script, I would say
local part = Instance.new("Part")
An instance is an object that can be seen in the explorer, for example, part or model
So would I add a part named IsCustom to my custom character?
If you look at the explorer in play mode in studio you’ll notice that characters are parented to workspace. Player.Character is a property of player and it’s a Reference to the character.
It doesn’t need to be a part. Folders, value objects and many other things are Instances too. You could add a folder and name it “IsCustom”.
I tried and it didn’t change anything. It still duplicates the character.
Did you include the quotation marks when naming the folder. If you did, remove them, but keep them in the script.
IT still doesn’t work.
Could you show a picture of the explorer, where I can see the character and its children.
In play mode?
30 characters
You can also take it in editmode, I want to see the character in ServerStorage
so, do you know a solution?
Unfortunately, I don’t. I’ll try to find what problem there is in the code I gave you when I’m on computer again.
local Players = game:GetService("Players")
local ID = -- the userid id of your friend
local customChar = game.ServerStorage.customchar
Players.PlayerAdded:Connect(function(plr)
if plr.UserId == ID then
plr.CharacterAdded:Connect(function(char)
if char.name ~= "customchar" then
char:Destroy()
local newChar = customChar:Clone()
newChar.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame
plr.Character = newChar
newChar.Parent = workspace
end
end)
end
end)