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

Why isnt this script working online?

Asked by
DevingDev 346 Moderation Voter
8 years ago
Edited 8 years ago

So. i am making a character chooser but when imma play it online then this script dosent work and gives me an error but Next is in the Frame so i dont know if it is the localscript that cant do so if i click on a button then it goes to the next character cus i am using a localscript but can't figure out why it isnt working so thats why i need help to solve this problem.

Script.

local Img = script.Parent.ImageLabel
local plr = game.Players.LocalPlayer
local Selectedo = script.Parent.Selected.Value

local HatNumber = 0
local Selected

function Choose()

end

script.Parent.Next.MouseButton1Down:connect(function()
    HatNumber = HatNumber + 1
    if HatNumber == 0 then
        script.Parent.Choosed.Text = "Selected: NONE"
    end
    if HatNumber == 1 then
        game.ReplicatedStorage.Selectable.BadmanBobby:Clone().Parent = workspace.Folder
        script.Parent.Choosed.Text = "Selected: Badman Bobby" -- TEXT
        if game.ReplicatedStorage.Selectable.BadmanBobby.Locked.Value == true then
            script.Parent.Locked.Visible = true
        elseif HatNumber <= 1 then
            script.Parent.Locked.Visible = false
        end
    elseif HatNumber == 2 then
            game.Workspace.Folder.BadmanBobby:Destroy()
    end
    if HatNumber == 2 then
        game.ReplicatedStorage.Selectable.SWATMansam:Clone().Parent = workspace.Folder
        script.Parent.Choosed.Text = "Selected: SWATMan sam" -- TEXT
        if game.ReplicatedStorage.Selectable.SWATMansam.Locked.Value == true then
            script.Parent.Locked.Visible = true
        elseif HatNumber <= 2 then
            script.Parent.Locked.Visible = false
        end
    elseif HatNumber == 3 then
        game.Workspace.Folder.SWATMansam:Destroy()
    end
    if HatNumber == 3 then
        game.ReplicatedStorage.Selectable.GuardGillbert:Clone().Parent = workspace.Folder
        script.Parent.Choosed.Text = "Selected: Guard Gillbert" -- TEXT
        if game.ReplicatedStorage.Selectable.GuardGillbert.Locked.Value == true then
            script.Parent.Locked.Visible = true
        elseif HatNumber <= 3 then
            script.Parent.Locked.Visible = false
        end
    elseif HatNumber == 4 then
        game.Workspace.Folder.GuardGillbert:Destroy()
    end
    if HatNumber == 4 then
        HatNumber = -1
    end
    print(HatNumber)
end)
"Next isnt valid member of Frame"

1 answer

Log in to vote
0
Answered by 8 years ago

where you have made variables like "Selected", instead of using the variable name each time, write out "script.Parent.Selected.Value".

Ad

Answer this question