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

Is there a way to make a function activate by 2 connections?

Trying to make an ax that needs mouse1down activated and the handle to be touching a part named ‘Tree’ to start another function. The problem is I don’t know how to connect the mouse1down function and ontouch function to the reward function. Someone help?

3 comments

0

Instead of thinking it that way you should use two separate scripts. You could use a local script to handle the tool Activations and a Script inside of the 'Tree' part. Use a Touched event to check if the parent of the part touching is a Tool or go to the character.

0

That's not a good idea if you have a decent amount of trees.

0

I'd use Raycasting but I still don't understand if this is what op wanted.

1 answer

roblox has a neat thing u can do to check what the parts are touching(:GetTouchingParts). Using that we can easily compress the two functions into one: a little like this:

mouse.Button1Down:Connect(function()
	for i, v in pairs(Handle:GetTouchingParts()) do
		if v.Name == "Tree" then
			-- fire the function
		end
	end
end)

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