Trying to make it so can chose a class by pressing a Image Button, but it isn't working, I think the event is not firing. There is nothing in the Output, the parenting is correct, and it is in the PlayerGui.
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() Button = script.Parent Folder = script.Parent.Parent.Parent.Parent.Folder Chosen_Yet = Folder.Chosen_Class -- Boolean that registers if they have chosen yet Current = Folder.Current_Class Colours = {BrickColor.new(152/255, 38/255, 40/255), BrickColor.new(75/255, 108/255, 90/255), BrickColor.new(152/255, 38/255, 40/255)} function Enter() if not Chosen_Yet then Button.ImageColor3 = BrickColor.new(156/255, 156/255, 156/255) -- Light Grey Current.Value = Button.Parent.Name end end Button.MouseEnter:connect(Enter) function Leave() if not Chosen_Yet then Button.ImageColor3 = BrickColor.new(68/255, 68/255, 68/255) -- Dark grey end end Button.MouseLeave:connect(Leave) function Click() if not Chosen_Yet and not Current then Button.ImageColor3 = Colours[1] Current.Value = script.Parent.Name Chosen_Yet.Value = true end end Button.MouseButton1Up:connect(Click)
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() Button = script.Parent Folder = script.Parent.Parent.Parent.Parent.Folder Chosen_Yet = Folder.Chosen_Class -- Boolean that registers if they have chosen yet Current = Folder.Current_Class Colours = {BrickColor.new(152/255, 38/255, 40/255), BrickColor.new(75/255, 108/255, 90/255), BrickColor.new(152/255, 38/255, 40/255)} function Enter() if not Chosen_Yet.Value then Button.ImageColor3 = BrickColor.new(156/255, 156/255, 156/255) -- Light Grey Current.Value = Button.Parent.Name end end Button.MouseEnter:connect(Enter) function Leave() if not Chosen_Yet.Value then Button.ImageColor3 = BrickColor.new(68/255, 68/255, 68/255) -- Dark grey end end Button.MouseLeave:connect(Leave) function Click() if not Chosen_Yet.Value then --and not Current? I don't understand what you mean by that when it's a stringValue Button.ImageColor3 = Colours[1] Current.Value = script.Parent.Name Chosen_Yet.Value = true end end Button.MouseButton1Up:connect(Click) --[[ add the .Values to the BoolValues, before you were basically asking the compiler if Chosen_Yet instance was not not nil (or nil) so it never executed. ]]
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() Button = script.Parent Folder = script.Parent.Parent.Parent.Parent.Folder Chosen_Yet = Folder.Chosen_Class -- Boolean that registers if they have chosen yet Current = Folder.Current_Class Colours = {BrickColor.new(152/255, 38/255, 40/255), BrickColor.new(75/255, 108/255, 90/255), BrickColor.new(152/255, 38/255, 40/255)} function Enter() if not Chosen_Yet then Button.ImageColor3 = UDim2.new(156/255, 156/255, 156/255) -- Light Grey Current.Value = Button.Parent.Name end end Button.MouseEnter:connect(Enter) function Leave() if not Chosen_Yet then Button.ImageColor3 = UDim2.new(68/255, 68/255, 68/255) -- Dark grey end end Button.MouseLeave:connect(Leave) function Click() if not Chosen_Yet and not Current then Button.ImageColor3 = Colours[1] Current.Value = script.Parent.Name Chosen_Yet.Value = true end end Button.MouseButton1Click:connect(Click)
try this i think it will work. but it will only work in a local script so copy this and paste it into a local script if you haven't already