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 » Scripting Helpers
Home Search
 

Whats Wrong with this??

Previous Thread :: Next Thread 
krazykaram is not online. krazykaram
Joined: 03 Jan 2009
Total Posts: 7140
17 Dec 2013 10:12 AM
It look fine but i doesnt clone the sword into the backpack heres the script:

player = script.Parent.Parent.Parent.Parent.Parent
cost = 500


function checkForSword()
found = false
for i, v in pairs(player.Backpack:GetChildern()) do
if v.Name == "Sword" then
found = true
end
end
for i, v in pairs(player.Character:GetChildern()) do
if v.Name == "Sword" then
found = true
end
end

if found == true then
return true
else
return false
end
end



script.Parent.MouseButton1Click:connect(function()
leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
points = leaderstats:FindFirstChild("Points")
if points then
hasSword = checkForSword()
if points.Value >= cost and hasSword == false then
sword = game.Lighting.Sword:Clone()
sword.Parent = player.Backpack
end
end
end
end)

Report Abuse
krazykaram is not online. krazykaram
Joined: 03 Jan 2009
Total Posts: 7140
17 Dec 2013 10:23 AM
Did i spell something wrong or?

-LMaD's Yellow Flash-
Report Abuse
krazykaram is not online. krazykaram
Joined: 03 Jan 2009
Total Posts: 7140
17 Dec 2013 10:32 AM
did i miss something??

-LMaD's Yellow Flash-
Report Abuse
ForceSky is not online. ForceSky
Joined: 30 Jul 2012
Total Posts: 2379
17 Dec 2013 10:37 AM
the returns should be in the function bro
Report Abuse
Dmoney433 is not online. Dmoney433
Joined: 31 Dec 2010
Total Posts: 3903
17 Dec 2013 10:37 AM
for i, v in pairs(player.Backpack:GetChildern()) do
if v.Name == "Sword" then
found = true
end
end
for i, v in pairs(player.Character:GetChildern()) do

Check your spelling on Children and that should fix it :)
Report Abuse
krazykaram is not online. krazykaram
Joined: 03 Jan 2009
Total Posts: 7140
17 Dec 2013 10:43 AM
oops thank you dmoney it works!

-LMaD's Yellow Flash-
Report Abuse
Dmoney433 is not online. Dmoney433
Joined: 31 Dec 2010
Total Posts: 3903
17 Dec 2013 10:46 AM
np :)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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