|
| 06 Mar 2013 02:16 PM |
This script was given to me from someone who posted on my other thread with insert service, but it appears to not work. I don't know why, Output gave me nothing. Here's the script:
local Player = game.Players.LocalPlayer local gun = game:GetService("InsertService"):LoadAsset(108124632) local LSVALUE = "Cash" --the name of the value in the ls you're comparing your cost with,
script.Parent.Text = script.Parent.ItemName.Value..": "..script.Parent.Cost.Value.." "..script.Parent.Currency.Value
script.Parent.MouseButton1Click:connect(function() if Player:findFirstChild("leaderstats") then if Player.leaderstats[LSVALUE].Value >= script.Parent.Cost.Value then Player.leaderstats[LSVALUE].Value = Player.leaderstats[LSVALUE].Value - script.Parent.Cost.Value gun:Clone().Parent=Player.Backpack gun:Clone().Parent=Player.StarterGear end end end) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 06 Mar 2013 07:35 PM |
gun.Parent = Workspace gun:Clone().Parent=Player.Backpack gun:Clone().Parent=Player.StarterGear
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Mar 2013 08:50 PM |
Using insertservice will give you a model. You'd have to extract it from the model.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
Usering
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 10281 |
|
|
| 06 Mar 2013 08:51 PM |
function unZip(model,parent) for _,v in pairs(model:GetChildren()) do v.Parent = parent end model:Destroy()
ID = 1337
insert = game:GetService("InsertService"):LoadAsset(ID) insert.Parent = workspace unZip(insert,workspace)
:D
~ Failure is the road to success ~ |
|
|
| Report Abuse |
|
|
Usering
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 10281 |
|
|
| 06 Mar 2013 08:52 PM |
dang it i've been forgetting ends like cray cray
function unZip(model,parent) for _,v in pairs(model:GetChildren()) do v.Parent = parent end model:Destroy() end
ID = 1337
insert = game:GetService("InsertService"):LoadAsset(ID) insert.Parent = workspace unZip(insert,workspace)
~ Failure is the road to success ~ |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 08:53 PM |
Well it's a tool. How do I do that? Do I put this: gun.Parent = Workspace gun.Python:clone().Parent = Player.Backpack gun.Python:clone().Parent = Player.StarterGear gun:remove() |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 08:54 PM |
Yes, if that's the name inside of the model. Though Usering's function does look nifty.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 08:56 PM |
| Yes, it does, but how do I put a line in it that makes sure you have enough cash and takes it away? |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 08:56 PM |
You already have that, just use his function.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 09:03 PM |
| I still am wondering, where does it go? Beginning, End, or Somewhere in the middle? |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 09:40 PM |
| Help? Where does Usering's script go in mine? |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Mar 2013 10:22 PM |
Put his function before yours, call it when you need to.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 06:29 AM |
Is this what it should be like? (Just a question, does it always have to be inserted into Workspace? I want to insert it into Lighting, where it unZips, so I don't have to worry about lag.)
function unZip(model,parent) for _,v in pairs(model:GetChildren()) do v.Parent = parent end model:Destroy() end
ID = 108124632
insert = game:GetService("InsertService"):LoadAsset(ID) insert.Parent = lighting unZip(insert,lighting)
local Player = game.Players.LocalPlayer local LSVALUE = "Cash" --the name of the value in the ls you're comparing your cost with,
script.Parent.Text = script.Parent.ItemName.Value..": "..script.Parent.Cost.Value.." "..script.Parent.Currency.Value
script.Parent.MouseButton1Click:connect(function() if Player:findFirstChild("leaderstats") then if Player.leaderstats[LSVALUE].Value >= script.Parent.Cost.Value then Player.leaderstats[LSVALUE].Value = Player.leaderstats[LSVALUE].Value - script.Parent.Cost.Value unZip() game.Lighting.Python.Parent = Player.Backpack game.Lighting.Python:clone().Parent = Player.StarterGear end end end) |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 06:32 AM |
Or would it be like this:
function unZip(model,parent) for _,v in pairs(model:GetChildren()) do v.Parent = parent end model:Destroy() end
ID = 108124632
insert = game:GetService("InsertService"):LoadAsset(ID)
local Player = game.Players.LocalPlayer local LSVALUE = "Cash" --the name of the value in the ls you're comparing your cost with,
script.Parent.Text = script.Parent.ItemName.Value..": "..script.Parent.Cost.Value.." "..script.Parent.Currency.Value
script.Parent.MouseButton1Click:connect(function() if Player:findFirstChild("leaderstats") then if Player.leaderstats[LSVALUE].Value >= script.Parent.Cost.Value then Player.leaderstats[LSVALUE].Value = Player.leaderstats[LSVALUE].Value - script.Parent.Cost.Value insert.Parent = lighting unZip(insert,lighting) game.Lighting.Python.Parent = Player.Backpack game.Lighting.Python:clone().Parent = Player.StarterGear end end end) |
|
|
| Report Abuse |
|
|
Usering
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 10281 |
|
|
| 07 Mar 2013 09:40 AM |
you can only forget the game prefix on workspace.
function unZip(model,parent) for _,v in pairs(model:GetChildren()) do v.Parent = parent end model:Destroy() end
ID = 108124632
insert = game:GetService("InsertService"):LoadAsset(ID)
local Player = game.Players.LocalPlayer local LSVALUE = "Cash" --the name of the value in the ls you're comparing your cost with,
script.Parent.Text = script.Parent.ItemName.Value..": "..script.Parent.Cost.Value.." "..script.Parent.Currency.Value
script.Parent.MouseButton1Click:connect(function() if Player:findFirstChild("leaderstats") then if Player.leaderstats[LSVALUE].Value >= script.Parent.Cost.Value then Player.leaderstats[LSVALUE].Value = Player.leaderstats[LSVALUE].Value - script.Parent.Cost.Value unZip(insert,game.Lighting) game.Lighting.Python:clone().Parent = Player.StarterGear,Player.Backpack end end end)
~ Failure is the road to success ~ |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 03:45 PM |
Yeaaaahhhh buddy! It works! |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 03:51 PM |
| Thanks Usering and KnightmareXD! |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Mar 2013 08:00 PM |
Try putting the LoadAsset part inside of the function.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 08:03 PM |
| It worked before, and it just stopped working. Maybe because of the update or I'm using recently updated/made models to be inserted. |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 08:14 PM |
Like I said, try doing this:
function unZip(model,parent) for _,v in pairs(model:GetChildren()) do v.Parent = parent end model:Destroy() end ID = 108124632 local Player = game.Players.LocalPlayer local LSVALUE = "Cash" --the name of the value in the ls you're comparing your cost with, script.Parent.Text = script.Parent.ItemName.Value..": "..script.Parent.Cost.Value.." "..script.Parent.Currency.Value script.Parent.MouseButton1Click:connect(function() if Player:findFirstChild("leaderstats") then if Player.leaderstats[LSVALUE].Value >= script.Parent.Cost.Value then Player.leaderstats[LSVALUE].Value = Player.leaderstats[LSVALUE].Value - script.Parent.Cost.Value insert = game:GetService("InsertService"):LoadAsset(ID) unZip(insert,game.Lighting) game.Lighting.Python:clone().Parent = Player.StarterGear,Player.Backpack end end end)
?
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|