DeGames
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 1028 |
|
|
| 07 Nov 2015 11:43 AM |
local player = game.Players.LocalPlayer local inventorySG = player.PlayerGui.InventoryScreenGUI local equip = inventorySG.Equip local sp = script.Parent
sp.MouseButton1Click:connect(function() equip.Visible = true if sp.Parent.Name == "SlotTaken" or "HKSlotTaken" then sp.Parent:FindFirstChild("Selected").Value= true else sp.Parent:FindFirstChild("Selected").Value= false end end) |
|
|
| Report Abuse |
|
|
|
| 07 Nov 2015 11:45 AM |
if sp.Parent.Name == "SlotTaken" or "HKSlotTaken" then
it would be
if sp.Parent.Name == "SlotTaken" or sp.Parent.Name=="HKSlotTaken" then |
|
|
| Report Abuse |
|
|
DeGames
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 1028 |
|
|
| 07 Nov 2015 11:45 AM |
Woops forgot to explain it and show you guys the error.
Error: Players.Player.PlayerGui.InventoryScreenGUI.Inventory.SlotTaken.Item.LocalScript:14: attempt to index field 'Selected' (a boolean value)
Selected is a BoolValue in the script.Parent.Parent What does it mean by attempted to index field? |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
| |
|
DeGames
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 1028 |
|
|
| 07 Nov 2015 11:47 AM |
sp.Parent:FindFirstChild("Selected").Value= true
is lien 14 |
|
|
| Report Abuse |
|
|
DeGames
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 1028 |
|
|
| 07 Nov 2015 12:51 PM |
I feel like its trying to find a property of sp.Parent that is called "Selected", but there's a BoolValue that is a child to the sp.Parent called "Selected". Not sure what's wrong.. |
|
|
| Report Abuse |
|
|
|
| 07 Nov 2015 12:53 PM |
if sp.Parent.Name == "SlotTaken" or "HKSlotTaken" then
That looks like this
if (sp.Parent.Name == "SlotTaken") or ("HKSlotTaken") then
You have to rewrite it as this
if sp.Parent.Name == "SlotTaken" or sp.Parent.Name == "HKSlotTaken" then
Instance.new("BodyVelocity",SenseiWarrior).velocity = CFrame.new(SenseiWarrior.Torso.Position,YourGirlsDMs.Position).lookVector * 10 |
|
|
| Report Abuse |
|
|
DeGames
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 1028 |
|
|
| 07 Nov 2015 12:54 PM |
I did rewrite it :C local player = game.Players.LocalPlayer local inventorySG = player.PlayerGui.InventoryScreenGUI local equip = inventorySG.Equip local sp = script.Parent
sp.MouseButton1Click:connect(function() equip.Visible = true if sp.Parent.Name == "SlotTaken" or sp.Parent.Name == "HKSlotTaken" then else sp.Parent:FindFirstChild("Selected").Value= false end end) |
|
|
| Report Abuse |
|
|
DeGames
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 1028 |
|
|
| 07 Nov 2015 12:56 PM |
local player = game.Players.LocalPlayer local inventorySG = player.PlayerGui.InventoryScreenGUI local equip = inventorySG.Equip local sp = script.Parent
sp.MouseButton1Click:connect(function() equip.Visible = true if sp.Parent.Name == "SlotTaken" or sp.Parent.Name == "HKSlotTaken" then sp.Parent:FindFirstChild("Selected").Value= true else sp.Parent:FindFirstChild("Selected").Value= false end end)
Woops accidentally deleted a part
OutPut: Players.Player.PlayerGui.InventoryScreenGUI.Inventory.SlotTaken.Item.LocalScript:14: attempt to index field 'Selected' (a boolean value) |
|
|
| Report Abuse |
|
|
DeGames
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 1028 |
|
|
| 07 Nov 2015 12:59 PM |
Something seems to be wrong with em saying:
sp.Parent:FindFirstChild("Selected").Value = true
Originally I had sp.Selected.Value = true
It gave the same error |
|
|
| Report Abuse |
|
|
DeGames
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 1028 |
|
|
| 07 Nov 2015 01:01 PM |
sp.Parent.Selected.Value = true*
i suc |
|
|
| Report Abuse |
|
|