01 | function OnHover(plr) |
02 | if script.Parent:FindFirstChild( "SelectionBox" ) = = nil then |
03 | f = Instance.new( "SelectionBox" ) |
04 | f.Parent = script.Parent |
05 | f.Adornee = script.Parent |
06 | if script.Parent:FindFirstChild( "Humanoid" ) = = nil then |
07 | h = Instance.new( "Humanoid" ) |
08 | h.Parent = script.Parent.Parent |
09 | h.MaxHealth = 0 |
10 | h.Health = 0 |
11 | script.Parent.Parent.Name = script.Parent.Parent.Name .. " [F]" |
12 | mouse = plr:GetMouse() |
13 | Slot 1 = plr.PlayerGui.Inventory.Scrolling.Slot 1 |
14 | Slot 2 = plr.PlayerGui.Inventory.Scrolling.Slot 2 |
15 | Slot 3 = plr.PlayerGui.Inventory.Scrolling.Slot 3 |
Now you see, the problem is, the image goes into the Gui and it goes in to all of them.
Anyone know a fix or maybe a way to add a table and test every slot to make sure it isn't equal to Rock or Nothing.
1 | if Slot 1. Item.Value = = "Nothing" or "Rock" then |
Has to be
1 | if Slot 1. Item.Value = = "Nothing" or Slot 1. Item.Value = = "Rock" then |
When you have the first, the if statement is actually checking two conditions. The first being Slot1.Item.Value == "Nothing"
, and the second being "Rock"
. In the case that Slot1.Item.Value
does not equal "Nothing"
, the if
statement will result to the expression after the or
. Since "Rock"
is neither nil
nor false
, it treats it as true
, causing the whole expression to become true, causing the code inside the following scope to execute. So just make sure you explicitly state what you're comparing the value to, like so in the second example.