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

How would I do a function to a other part?

What I mean is like saying, if a part is somewhere, and it touches a other part, it does the function to that part, and not the players.

My guess is that it goes something like this :

function onTouch(touched)
	if script.Parent.Touched:connect ~= humanoid then
	end
	if script.Parent.Touched:connect == humanoid then
	end
end
	
script.Parent.Touched:connect(onTouched)

1 answer

✓ Accepted answer

The way you worded it is a bit confusing. Let me get this right. If you're trying to make the code run, if the object that touched a part is NOT a player, then here you go:

script.Parent.Touched:connect(function(hit)
	if not game.Players:GetPlayeFromCharacter(hit.Parent) then
		-- Your code
	end
end)

If you want it to run if it's a player, remove the "not" in line 2!

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