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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 06 Sep 2015 02:05 PM |
| but what if he was not kill? |
|
|
| Report Abuse |
|
|
kakbroek1
|
  |
| Joined: 16 Dec 2013 |
| Total Posts: 136 |
|
| |
|
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 |
|
|