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

Unable to change hats?

Asked by 6 years ago

Hi

I'm currently making a game and at the moment I'm making the character-editing system, for some reason when I'm doing the hairs, they don't clone over to the character.

The script is in a server-side script, not a local-script; the character is currently in the camera. The game is filtering-enabled and I have used individual server-events to move the character to the camera - however, I'm not sure as to why this isn't working? No errors on output. Any help would be appreciated!

hairs = {}
current_hair = 1
wait(5)
for _,v in pairs (game:GetService("ServerStorage").PlayerHairs.Hair:GetChildren()) do
    if v:IsA("Accessory") then
        table.insert(hairs, v.Name)
    end
end
table.sort(hairs)

script.Parent.Back_button.MouseButton1Click:connect(function()
    if current_hair > 1 then
        current_hair = current_hair - 1
        for _,v in pairs (script.Parent.Parent.Parent.Parent.Parent.Character:GetChildren()) do
            if v:IsA("Accessory") then 
                v:destroy()
            end
        end
        wait()
        game:GetService("ServerStorage").PlayerHairs.Hair:FindFirstChild(hairs[current_hair]):clone().Parent = script.Parent.Parent.Parent.Parent.Parent.Character
    elseif current_hair == 1 then
        current_hair = #hairs
        for _,v in pairs (script.Parent.Parent.Parent.Parent.Parent.Character:GetChildren()) do
            if v:IsA("Accessory") then 
                v:destroy()
            end
        end
        wait()
        game:GetService("ServerStorage").PlayerHairs.Hair:FindFirstChild(hairs[current_hair]):clone().Parent = script.Parent.Parent.Parent.Parent.Parent.Character
    end
end)

script.Parent.Forward_button.MouseButton1Click:connect(function()
    if current_hair < #hairs then
        current_hair = current_hair + 1
        for _,v in pairs (script.Parent.Parent.Parent.Parent.Parent.Character:GetChildren()) do
            if v:IsA("Accessory") then 
                v:destroy()
            end
        end
        wait()
        game:GetService("ServerStorage").PlayerHairs.Hair:FindFirstChild(hairs[current_hair]):clone().Parent = script.Parent.Parent.Parent.Parent.Parent.Character
    elseif current_hair == #hairs then
        current_hair = 1
        for _,v in pairs (script.Parent.Parent.Parent.Parent.Parent.Character:GetChildren()) do
            if v:IsA("Accessory") then 
                v:destroy()
            end
        end
        wait()
        game:GetService("ServerStorage").PlayerHairs.Hair:FindFirstChild(hairs[current_hair]):clone().Parent = script.Parent.Parent.Parent.Parent.Parent.Character
    end
end)
0
Is it making it near the character (like is it just not going where it should be going) or is it just not being replicated at all? xXGokyXx 46 — 6y

Answer this question