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

Custom hat won't clone into local player?

Asked by 5 years ago
Edited 5 years ago

Code

game.Players.PlayerAdded:connect(function(p) 
    p.Chatted:connect(function(msg)
        msg = msg:lower() 
        if (msg == "ssj") then 
            if (p.Character ~= nil) then
                    game.Players.LocalPlayer.Character.gokuhair:Destroy()
                            game.ServerStorage.ssjgoku:Clone().Parent = game.Players.LocalPlayer.Character
            end 
        end 
    end) 
end)

game.Players.LocalPlayer.Chracter.gokuhair:Destroy() Works fine but game.ServerStorage.ssjgoku:Clone().Parent = game.Players.LocalPlayer.Chracter doesn't work?

Am I doing something wrong here? If so tell me what I'm doing wrong.

Item tree https://gyazo.com/f4aae72a66fdadcde486abf160fb32bf

0
local playerLocal = game:GetService("Players").LocalPlayer local character = playerLocal.Character or playerLocal.CharacterAdded:Wait() if not character or character.Parent == nil then character = playerLocal.CharacterAdded:wait() end game.Players.LocalPlayer.Character.gokuhair:Destroy() local clone = game.ServerStorage.ssjgoku:Clone() clone.Parent = character clone:MakeJoints() clone.Archivable brok4d 77 — 5y
0
you have to save things well that code is not worth it because that is not well written, you have to save it in a localscript within StarterPack or StarterGui, attentive only lets you run a localscript the StarterPack. brok4d 77 — 5y

1 answer

Log in to vote
1
Answered by
brok4d 77
5 years ago
Edited 5 years ago

You are referencing the hair parent that is the ServerStorege, remove the Parent.

local playerLocal = game:GetService("Players").LocalPlayer
local character = playerLocal.Character or playerLocal.CharacterAdded:Wait()

if not character or character.Parent == nil then
 character = playerLocal.CharacterAdded:wait()
end
game.Players.LocalPlayer.Character.gokuhair:Destroy()
local clone = game.ServerStorage.ssjgoku:Clone()
clone.Parent = character
clone:MakeJoints()
clone.Archivable = true

0
Where do I put it in the script tho? I'm a lil confused atm. LoganboyInCO 150 — 5y
0
localscript within StarterPack or StarterGui, attentive only lets you run a localscript the StarterPack. brok4d 77 — 5y
Ad

Answer this question