Hi, I’m trying to make a Character Save System. The problem is when you load accessory it will fall off.
This is the an example of the script:
if UniformPack:FindFirstChild("Universal Goggles") then
local UniversalGoggles = UniformPack:FindFirstChild("Universal Goggles")
local UniversalGogglesClone = UniversalGoggles:Clone()
UniversalGogglesClone.Parent = Char
end
These are the locals if you get confused:
local Player = game.Players.LocalPlayer
local Char = Player.Character
local UniformPack = Player:FindFirstChild("UniformPack")
I’m still confused and haven’t found any solutions to this problem.
4 Likes
Are the goggles an Accessory
or are they a MeshPart
?
2 Likes
The Goggles are Accessories (Can’t short text)
2 Likes
Then instead of doing
UniversalGogglesClone.Parent = Char
do
local Humanoid = Char:FindFirstChild("Humanoid")
Humanoid:AddAccessory(UniversalGogglesClone)
2 Likes
Like this?
if UniformPack:FindFirstChild("Universal Goggles") then
local UniversalGoggles = UniformPack:FindFirstChild("Universal Goggles")
Humanoid:AddAccessory(UniversalGogglesClone)
end
2 Likes
Make sure to clone the accessory before you call AddAccessory
2 Likes
?
if UniformPack:FindFirstChild("Universal Goggles") then
local UniversalGoggles = UniformPack:FindFirstChild("Universal Goggles")
UniversalGoggles:Clone()
Humanoid:AddAccessory(UniversalGogglesClone)
end
2 Likes
Do this
if UniformPack:FindFirstChild("Universal Goggles") then
local UniversalGoggles = UniformPack:FindFirstChild("Universal Goggles")
local ClonedUniversalGoggles = UniversalGoggles:Clone()
Humanoid:AddAccessory(ClonedUniversalGoggles)
end
2 Likes
Alright I’ll try (Can’t short text)
2 Likes
Attempt to index nil with Accessory
2 Likes
Is Humanoid
defined? If not, define it with the variables at the start.
local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait() -- added Player.CharacterAdded:Wait() in case the player's character hasn't loaded yet
local Humanoid = Char:WaitForChild("Humanoid")
-- Make sure to redefine the variables whenever the player respawns so the script won't error (for example, Humanoid being nil after respawning)
local function playerRespawn(newCharacter)
local newHumanoid = newCharacter:WaitForChild("Humanoid")
Char = newCharacter
Humanoid = newHumanoid
end
Player.CharacterAdded:Connect(playerRespawn) -- connect the function to the event that fires whenever the player respawns
local UniformPack = Player:FindFirstChild("UniformPack")
3 Likes
Alright I’ll try that tommorow I’m busy right now
1 Like
Wait uhhhh how is that supossed to work?
1 Like
replace these
with my answer
also don’t just copy code, try to understand the code i gave
1 Like
Oh… I meant I already did that
1 Like