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

It will not scroll through all my hats only one?

Asked by 7 years ago
Edited 7 years ago
local plr = game.Players.LocalPlayer
local c = plr.Character
local gui = plr:WaitForChild("PlayerGui").main
local back = gui.character_custom.Background
local hairleft = back.hair_scroll.left
local hair = back.hair_scroll
local rp = game:GetService("ReplicatedStorage")
local Hatsc = rp.CC.Hats:GetChildren()
local Hats = rp.CC.Hats
local CC1 = game.Workspace.CC1
local CC2 = game.Workspace.CC2
local CC3 = game.Workspace.CC3
local CC4 = game.Workspace.CC4
local CD1 = CC1.Dummy
local CD2 = CC2.Dummy
local CD3 = CC3.Dummy
local CD4 = CC4.Dummy
local CC = plr:FindFirstChild("CC")
page = 1
pagemax = #Hatsc
pagemin = 1
script.Parent.MouseButton1Click:connect(function()
    page = page - 1
    hairleft.Visible = true
    local sc = plr.PlayerScripts.CameraM
    sc.Disabled = false
    if page == pagemin then
        hairleft.Visible = false
    else
        hairleft.Visible = true
    for _, v in pairs(Hats:GetChildren()) do
            local hat = v
            script.Parent.Parent.Text = v.Name
            if CC.Value == 1 then
                if CD1:FindFirstChildOfClass("Accessory") then
                    local remove = CD1:FindFirstChildOfClass("Accessory")
                    remove:Destroy()
                    local hat = v:Clone()
                    hat.Parent = CD1
                else
                    local hat = v:Clone()
                    hat.Parent = CD1
                end
            elseif CC.Value == 2 then
                if CD2:FindFirstChildOfClass("Accessory") then
                    local remove = CD2:FindFirstChildOfClass("Accessory")
                    remove:Destroy()
                    local hat = v:Clone()
                    hat.Parent = CD2
                else
                    local hat = v:Clone()
                    hat.Parent = CD2
                end
            elseif CC.Value == 3 then
                if CD3:FindFirstChildOfClass("Accessory") then
                    local remove = CD3:FindFirstChildOfClass("Accessory")
                    remove:Destroy()
                    local hat = v:Clone()
                    hat.Parent = CD3
                else
                    local hat = v:Clone()
                    hat.Parent = CD3
                end
            elseif CC.Value == 4 then
                if CD4:FindFirstChildOfClass("Accessory") then
                    local remove = CD4:FindFirstChildOfClass("Accessory")
                    remove:Destroy()
                    local hat = v:Clone()
                    hat.Parent = CD4
                else
                    local hat = v:Clone()
                    hat.Parent = CD4
                end
            end
        end
    end
end)

my problem is it will load the default hair but no others even though there are more in the folder this is on a textbutton with a LocalScript

0
Any output errors? superalp1111 662 — 7y
0
Nope johndeer2233 439 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

I can't comment so, I'll say this, please explain the conditions for studio this script works in.

Like where is the script being placed inside of? And what exactly are you trying to make?

0
Ok so This script is a local script located in a textbutton to go left or right johndeer2233 439 — 7y
0
Im trying to make a script that when you click the left button or right button it will scroll through all the hats and place them on a dummy johndeer2233 439 — 7y
0
The only problem is. Is when I click either the left or right buttons it will only do the default hat johndeer2233 439 — 7y
Ad

Answer this question