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

How do you make a button that executes scripts on touch?

Im trying to make a pad, and if your character touches it, it executes a script.

1 answer

✓ Accepted answer

You can use the .Touched method of a BasePart (touchpad) in order to execute a piece of code when that BasePart is touched.

Example:

local part = workspace.Touchpad

part.Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChild("Humanoid") then -- check if part is a character
		--execute code here 
	end
end)

Hope I helped. If you have any questions please let me know.

1 comment

0

Thanks

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