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:

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

Log in to vote
1
Answered by 10 years ago
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.

Ad

Answer this question