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

Changing the Value works in Roblox Studio but not on Roblox. Why doesnt it work?

Asked by 4 years ago

If I play it in Roblox Studio I can change to the next Hair but if I try it in real Roblox it doesn't work the same thing for showing the Hairstyle on the label. There are also no errors in the console. Can someone help?

game.Players.PlayerAdded:Connect(function(plr)  
    --Varible for objects

    local PlrGui = plr.PlayerGui
    local CustGui = PlrGui:WaitForChild("CustomizeChar")
    local HairFrame = CustGui.Hair
    local HairButton = HairFrame.Hair
    local HairRightButton = HairFrame.HairRight
    local HairLeftButton = HairFrame.HairLeft
    local Male = HairFrame.Male
    local Female = HairFrame.Female
    local SkinColorFrame = CustGui.SkinColor

    --Values
    local Gender = plr.CharValues.Geschlecht
    local HairValue = plr.CharValues.HairValue

    --Other Varibles
    local db = false



    --Main


    HairRightButton.MouseButton1Click:Connect(function() --When player presses Hair next Button
        if db == false then --Checks cooldown
            db = true -- sets db to true
            if Gender.Value == "Male" then --checks if the gender of the person is Male
                -- Does the stuff
                if HairValue.Value == "Wavy" then 
                    HairValue.Value = "Styled"
                elseif HairValue.Value == "Styled" then
                    HairValue.Value = "Bald"
                elseif HairValue.Value == "Bald" then
                    HairValue.Value = "Wavy"

                end


            elseif Gender.Value == "Female" then --checks if the gender of the person is Female
                -- Does the stuff

            end
            wait(0.5)
            db = false
        end
    end)

    while true do
        HairButton.Text = "Hair: "..HairValue.Value
        wait()
    end
end)
0
Scripts can't detect when the LocalPlayer's Mouse is clicked, and use a LocalScript to edit the PlayerGui. nogoaway6 20 — 4y

Answer this question