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

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

Asked by 3 years 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 3 years 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