generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: What is this error?

Previous Thread :: Next Thread 
DeGames is not online. 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
jumpykilldestroy is not online. jumpykilldestroy
Joined: 15 Jul 2012
Total Posts: 12319
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 is not online. 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 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
07 Nov 2015 11:46 AM
What's line 14?
Report Abuse
DeGames is not online. 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 is not online. 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
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
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 is not online. 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 is not online. 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 is not online. 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 is not online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
07 Nov 2015 01:01 PM
sp.Parent.Selected.Value = true*

i suc
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image