Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

When Part is Touched, Player Recieves Item?

Asked by 10 years ago

I don't want the item to stay in the users inventory when they die.

This is what I have:

1function.ontouch("Brick1")
2    give (user) ("Sword1")
3        wait(0)
4    end

Any help is appreciated. Oh and don't say I didn't try because I did, I'm a noob scripter. Thanks!

1 answer

Log in to vote
1
Answered by 10 years ago
1brick = game.Workspace.Part
2item = game.Lighting.Sword
3 
4brick.Touched:connect(function(hit)
5item:Clone().Parent = hit.Parent
6end)

You'd need a debounce so the player doesn't get a million swords, and depending on your situation, a line to check if the part that touches the brick is actually part of the player.

Ad

Answer this question