Okay, so i know how to detect if parts have touched, but i'm not sure how to detect if parts are touchING, i'm making the player's controller (that is if they are playing on controller) vibrate as long as a specific part is touching another anchored part, say, a block of ground, i used .Touched but i forgot that it only worked at the moment of the two parts touching, and didn't continue anymore (the vibrating is meant to be constant, so this doesn't work as it just stops after a small amount of time, i am unsure if i also have to detect when the parts stop touching to stop the vibration, so if anyone could help me out with that too then that'd be awesome
tl;dr: dont know how to detect constant contact between parts, help pls
local ps = game:GetService("Players") ps.PlayerAdded:Connect(function(plr) local val = Instance.new("BoolValue",plr.Character) -- set the parent to anything local part = workspace.Map.VibaratePart part.Touched:Connect(function(t) if t.Parent == plr.Character then val = true part.TouchEnded:Connect(function() val = false end) end) end end)
Use https://developer.roblox.com/en-us/api-reference/function/BasePart/GetTouchingParts. As documented there, if you have non-CanCollide parts involved, you may need to add TouchInterests, as explained here: https://devforum.roblox.com/t/simple-trick-to-make-gettouchingparts-work-with-non-cancollide-parts/177450
(answered by imKirda through comments, perfectly solves the issue i was having)