Ad
Log in to vote
1

How to do this when you step on a part you get a thing?

Asked by 13 days ago

please tell im stupid local function onTouch(Part) print("Touch started: " .. Part.Name) numTouchingParts = numTouchingParts + 1 tl.Text = numTouchingParts end

local function onTouchEnded(Part) print("Touch ended: " .. Part.Name) numTouchingParts = numTouchingParts - 1 tl.Text = numTouchingParts end

Part.Touched:Connect(onTouch) if canGive == false then canGive = true local clone = tool:Clone() clone.Parent = Player.Backpack wait(1) canGive = false end

Part.TouchEnded:Connect(onTouchEnded)

1 answer

Log in to vote
0
Answered by 13 days ago

Next time use a code block.

Put your tool in ReplicatedStorage.

local tool = ReplicatedStorage.Tool

script.Parent.Touched:Connect(function()
    tool.Clone(). Parent = player.Backpack
end

Make sure to find the player as I can't do everything for you. I hope this helps. :)

Ad

Answer this question