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: help with sword

Previous Thread :: Next Thread 
321orr is not online. 321orr
Joined: 21 Dec 2011
Total Posts: 206
06 Sep 2015 01:48 PM
I can buy a couple of times I want the sword anyone can help me


but = script.Parent
player = game.Players.LocalPlayer
points = player.leaderstats.Points

chekb = player.Backpack:GetChildren()
chekc = player.Character:GetChildren()

function cheksword()
found = false
for i,v in pairs (chekb) do
if v.Name == "sword" then
found = true
end
end


for i,v in pairs (chekc) do
if v.Name == "sword" then
found = true
end
end
if found == true then
return true
else
return false
end
end


but.MouseButton1Click:connect(function()
havesword = cheksword()
if points.Value >= 500 and havesword == false then
points.Value = points.Value - 500
sword = game.Lighting.sword:Clone()
sword.Parent = player.Backpack
end




end)
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
06 Sep 2015 02:03 PM
local hasSword = false
local button = script.Parent
local plr = game.Players.LocalPlayer

local function hasSword()
for i, v in pairs(plr.Backpack:GetChildren()) do
if v:IsA("Tool") and v.Name == "NameOfYourSword, the name is case sensitive" then
return true
end
end

for i, v in pairs(plr.Character:GetChildren()) do
if v:IsA("Tool") and v.Name == "NameOfYourSword, the name is case sensitive" then
return true
end
end

return false
end

button.MouseButton1Click:connect(function()
if not hasSword() and plr.leaderstats.Points >= 500 then
plr.leaderstats.Points,Value = plr.leaderstats.Points.Value - 500
local sword = game.Lighting.yourSword:Clone()
sword.Parent = plr.Backpack
end
end)
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
06 Sep 2015 02:04 PM
"local hasSword = false"

remove that line at the top of my script, sorry

also pro tip: don't use Lighting to store objects. use ReplicatedStorage or ServerStorage (in this case, ReplicatedStorage because you seem to be doing all of this in a local script, and FE seems to be off)
Report Abuse
HarrySnotte is not online. HarrySnotte
Joined: 27 Jun 2011
Total Posts: 2854
06 Sep 2015 02:05 PM
but what if he was not kill?
Report Abuse
kakbroek1 is not online. kakbroek1
Joined: 16 Dec 2013
Total Posts: 136
06 Sep 2015 02:05 PM
then he was killer
Report Abuse
kakbroek1 is not online. kakbroek1
Joined: 16 Dec 2013
Total Posts: 136
06 Sep 2015 02:06 PM
OK first my friend ask a question in ENGLISH and not in HALF noobish English cause none knows what u mean
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