Collision detection help

Hi everyone! Im trying to make a part collide with ‘Paper’ Tool, And once it does that it deletes the paper, And increases the money currency (In leaderstats)

My problem is the collision detection, I haven’t found a way to do it, But this is my broken script I came up with:

local part = script.Parent
local handle = game.ReplicatedStorage.Paper

local function onPartTouched(Handle)
	print(part.Name .. " has touched " .. Handle)
end

part.Touched:Connect(onPartTouched)

Thanks!

1 Like

Try this:
print(part.Name .. " has touched " .. Handle.Name)

Different collision group baseparts aren’t capable of interacting with each other. If you want to keep this behaviour then have a invisible cancollide false part welded as the size boundingbox of your character and have it the same collission group as the paper

Now it tells me what every part has touched.

Then the problem is from the Handle variable.

The handle is inside the paper, and the paper is a rectangle, So I don’t need one, I’m not detecting the tool but what is inside it I am.

Paper is a tool, And inside it is called handle.

I have tried changing the variable to no avail, What do you mean?

What is the tools parent? Workspace or the players Character?

Replicated storage, And then when a button is pressed its then cloned into workspace, Where you can put in in your starterpack, By picking it up.

I have updated the script, Not realised my mistake but it still isn’t working???

local part = script.Parent
local handle = game.Workspace.Paper.Handle -- changed variable to actual place.
local function onPartTouched(Handle)
	print((part.Name .. " has touched " .. handle.Name))
end

part.Touched:Connect(onPartTouched)

My first response was referring to something completely different. I was assuming you was having an issue with different collision groups. I’m extremely confused to what you’re attempting to achieve also your code above is still wrong, You need to capitalize the first letter of "h"andle.Name. If they are both the same collision group and the handle actively collides with the “part” then this would work. if that’s not the problem, Since it’s not working something else is wrong with your workspace layout.

I want this to happen: When paper collides with SellPoint, Delete paper, And add leaderstat currency to it, My trouble is the collision part, The part is anchored, And collide set to true.

Once the paper is spawned, It is in workspace, Then after you pick it up, It is in Player.Backpack. Then when you drop it its back into workspace.

Once testing your fix, This happened.
“Position is not a valid member of workspace.paper”

paper is a tool it has no position, paper.Handle.Position

"Paper is not a valid member of Workspace “Workspace” – must be because once picked up, there is no paper in workspace

"Position is not a valid member of Tool “Workspace.Paper”

I think I should make it so you can touch it and it detects everything, Then add an if statement to say if it touched handle, Can you help with that?