Gui Button Sometimes Working?
Asked by
8 years ago Edited 8 years ago
Things To Know
Local Script
,Gui Button
,Everything is in thier proper places
,No Errors In output
,Non Filtering Enabled Place
Problem: Let's say I'd join the game, Once i have met all the requirements, I would press the Equip Button, NOTHING HAPPENS, then I leave and join the place again, And I do the EXACT Same thing and press the Equip Button, And it works, IDK why this happens, Second Problem is that if I were to equip and unequip and re-equip the tool would not be there, what i mean by that is that i can equip the tool but i am not holding anything, it's like an empty tool.
Script
01 | player = game.Players.LocalPlayer |
02 | local leaderstats = player:WaitForChild( "leaderstats" ) |
03 | local Tool = leaderstats:WaitForChild( 'StoneSword' ) |
04 | local cl = game.ReplicatedStorage:FindFirstChild( "StoneSword" ) |
06 | local Bought = script.Parent:WaitForChild( 'HasBought' ) |
07 | local CurImage = script.Parent.Parent:WaitForChild( 'ImageLabel' ) |
09 | local UnequipedColor = BrickColor.new( "Really red" ) |
10 | local UnequipedColor 2 = UnequipedColor.Color |
11 | local EquipColor = BrickColor.new( "Lime green" ) |
12 | local EquipColor 2 = EquipColor.Color |
13 | local AnyEquiped = script.Parent.Parent.Parent.Parent:WaitForChild( 'MeleeEquip' ) |
14 | local NA = script.Parent:WaitForChild( 'NA' ) |
15 | local Player = game.Players.LocalPlayer |
16 | local Character = player.CharacterAdded:wait() |
17 | local Humanoid = Character:WaitForChild( 'Humanoid' ) |
18 | local Type = script.Parent.Parent.Parent.Parent:WaitForChild( 'Character' ):WaitForChild( 'Melees' ):WaitForChild( 'ImageLabel' ) |
19 | local sound = script.Parent:WaitForChild( 'Equip' ) |
24 | if Bought.Value = = true then |
25 | if Equiped = = false then |
26 | if AnyEquiped.Value = = false then |
27 | Type.Image = script.Parent.Parent.ImageLabel.Image |
28 | cl 2. Parent = player.Backpack |
29 | script.Parent.BackgroundColor 3 = EquipColor 2 |
30 | AnyEquiped.Value = true |
32 | script.Parent.Text = 'UnEquip' |
36 | elseif Bought.Value = = true then |
37 | if Equiped = = true then |
38 | Humanoid:UnequipTools() |
41 | player.Backpack:findFirstChild( "StoneSword" ):remove() |
42 | script.Parent.BackgroundColor 3 = UnequipedColor 2 |
43 | AnyEquiped.Value = false |
45 | script.Parent.Text = 'Equip' |
54 | script.Parent.MouseButton 1 Click:connect(Check) |
UPDATE: I have added a print, at the very beggining of the script, The local script is NOT disabled and the button is Clickable but NOTHING Prints when i press f9 in play mode, ???????