bobosaid
|
  |
| Joined: 26 Feb 2011 |
| Total Posts: 10760 |
|
|
| 24 Dec 2011 09:44 PM |
This is a script for a GUI shop thing I am making. It is supposed to give you the tool when the GUI button pressed and when you have enough kills/KOs. This is the script
player = script.Parent.Parent.Parent.Parent.Parent KOs = player.leaderstats.Kills price = 15 tool = game.Lighting:findFirstChild("LightSword") --this is were you put the weapon name mk simple right it could be ("derpsword")
function buy() if KOs.Value >= price then local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear
end end script.Parent.MouseButton1Down:connect(buy)
It works correctly in my head, But doesn't work. |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2011 09:54 PM |
Save yourself some trouble. Seriously. LOCALSCRIPTS.
player = Game.LocalPlayer KOs = player.leaderstats.Kills price = 15 tool = game.Lighting:findFirstChild("LightSword")
script.Parent.MouseButton1Down:connect(function(m) if KOs.Value >= price then local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear -- It might be StarterPack. end)
-They say that love is forever, your forever is all that I need. |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2011 10:02 PM |
These might be the errors. I don't do GUI scripts much...
line 2 - KOs = player.Leaderstats.("Kills") - If you don't " it, workspace won't know what it is.
line 4 - tool = game.Lighting:findFirstChild("LightSword") --this is where you put the weapon name (what is the mk word? Scripts can't function right if something doesn't make sense) simple right it could be. - The script won't function right if it doesn't know if it does Lightsword or Derpsword.
That is all I see, you script should look like this :
player = script.Parent.Parent.Parent.Parent.Parent KOs = player.leaderstats.("Kills") price = 15 tool = game.Lighting:findFirstChild("LightSword") --this is where you put the weapon name ?? simple right it could be.
function buy() if KOs.Value >= price then local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear
end end script.Parent.MouseButton1Down:connect(buy)
|
|
|
| Report Abuse |
|
|
|
| 24 Dec 2011 10:04 PM |
| I don't know. I don't do GUI scripts. |
|
|
| Report Abuse |
|
|
DXPower
|
  |
| Joined: 21 Oct 2008 |
| Total Posts: 2866 |
|
|
| 24 Dec 2011 10:27 PM |
@Metaplates
Um, I believe it's game.Players.LocalPlayer.... |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2011 10:29 PM |
@DXPower It was a mistype, excuse me. =]
-They say that love is forever, your forever is all that I need. |
|
|
| Report Abuse |
|
|