|
So I don't know much of Lua. By that I mean I don't know how to script but I just would like to know for my one game, does anyone have a script where you pick a click detector in a item and when you click it, it gives you the item and the item on the ground disappears and appears only a minute later? Please help. |
|
|
LuluPlsJoin Date: 2010-08-23 Post Count: 1221 |
what do you mean by "it gives you the item". Do you have an inventory system? Is it a tool? |
|
AIexandxrJoin Date: 2015-05-29 Post Count: 1708 |
what do you think he means...
R$#inf |
|
LuluPlsJoin Date: 2010-08-23 Post Count: 1221 |
I don't know. That's why I'm asking. |
|
|
I have a card. It's on the floor, if you press it sends it to your inventory and the card disappears off the floor and then you gotta wait a minute for it to respawn. |
|
|
It's a tool, I put it in lighting and server storage |
|
LuluPlsJoin Date: 2010-08-23 Post Count: 1221 |
Well first of all, if you want to pick it up by clicking it, you will want to take the parts inside that tool and make it into a model. Put that in workspace, and put a click detector in each part, along with this script:
script.Parent.ClickDetector.MouseClick:connect(function(plr)
c=game.Lighting:FindFirstChild("NAMEOFYOURTOOL"):Clone()
c.Parent=plr.Backpack
script.Parent.Parent:Destroy()
end) |
|
TaaRtJoin Date: 2009-04-26 Post Count: 5070 |
A ClickDetector parented to a model will make all parts within that model react to clicks for it |
|
|
But, you see. This is what my developer did but I want the card to disappear after you click it for a minute
|
|
LuluPlsJoin Date: 2010-08-23 Post Count: 1221 |
If you have a script in each part use this:
script.Parent.ClickDetector.MouseClick:connect(function(plr)
c=game.Lighting:FindFirstChild("NAMEOFYOURTOOL"):Clone()
c.Parent=plr.Backpack
script.Parent.Parent.Parent=game.Lighting
wait(60)
script.Parent.Parent.Parent=game.Workspace
end)
If you did what TaaRT suggested and put the clickdetector and script in the model itself instead of each part (which I agree with) use this:
script.Parent.ClickDetector.MouseClick:connect(function(plr)
c=game.Lighting:FindFirstChild("NAMEOFYOURTOOL"):Clone()
c.Parent=plr.Backpack
script.Parent.Parent=game.Lighting
wait(60)
script.Parent.Parent=game.Workspace
end) |
|
|