Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When Part is Touched, Player Recieves Item?

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

This is what I have:

function.ontouch("Brick1")
	give (user) ("Sword1")
		wait(0)
	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

✓ Accepted answer
brick = game.Workspace.Part
item = game.Lighting.Sword

brick.Touched:connect(function(hit)
item:Clone().Parent = hit.Parent
end)

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.