I am attempting to add an accessory onto a character however it doesn’t seem to be working, does anyone know why? The accessory object appears on the player under the explorer view but it doesn’t show on the player.
local RunService = game:GetService("RunService")
local plr = game.Players.LocalPlayer
local plrScript = plr:WaitForChild("PlayerScripts")
local plrMod = require(plrScript:WaitForChild("PlayerModule"))
local Controls = plrMod:GetControls()
local setting = plr.Character:WaitForChild("Settings")
local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local Camera = workspace.Camera
local UIS = game:GetService("UserInputService")
local KeyBind = "E"
local repstor = game:GetService("ReplicatedStorage")
local selectedScene = setting.Hero.Value
local animClone = repstor.Animations[selectedScene]:Clone()
local soundClone = repstor[selectedScene]:Clone()
animClone.Parent = Character
soundClone.Parent = Character
local anim = Character:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(animClone)
local transforming = false
local outfitEv = repstor.OutfitChange
function Clothes()
if selectedScene == "Hero" then
wait(7.02)
local hat = repstor.Outfits[selectedScene].Hat:Clone()
Character.Humanoid:AddAccessory(hat)
wait(1.51)
if Character.Shirt then
Character.Shirt:Destroy()
local shirt = repstor.Outfits[selectedScene].Shirt:Clone()
shirt.Parent = Character
else return
end
wait(1.06)
if Character.Pants then
Character.Pants:Destroy()
local pants = repstor.Outfits[selectedScene].Pants:Clone()
pants.Parent = Character
else return
end
end
end
function Animation()
Controls:Disable()
transforming = true
soundClone:Play()
anim:Play()
Clothes()
anim.Stopped:Wait()
transforming = false
Controls:Enable()
outfitEv:FireServer(plr)
end
UIS.InputBegan:Connect(function(input)
if transforming == false then
if input.KeyCode == Enum.KeyCode[KeyBind] then
Animation()
end
else
return
end
end) ```