More context:
This is a part of a clock movement, aka a “Chime Drum” or “Chime Barrel”. This part is supposed to activate on the quarters and spin, when the teeth on the barrel come in contact with the hammer’s tail, it will lift it up and release it once it spins over it, making it strike a bell or a chime rod.
Both are unions and are already set to PreciseConvexDecomposition.
I already tried enabling “Show Decomposition Geometry” in Studio’s settings but it didn’t really help me.
By the way, THIS is “lilpart”, it is supposed to be the hammer’s tail:
The touched function is running everytime the part is touching any other part so you have to verify if the touched part is the right one before to run the code.
Actually, your lilpart is constantly in collision with other yellow parts, so the touched function will run non-stop.
local lilpart = script.Parent.Hammer.lilpart
local BlackCylinder = ...
lilpart.Touched:Connect(function(Hit)
if Hit == BlackCylinder then
script.Parent.HingeConstraint.MotorMaxTorque = 100000
end
end)
Well, there’s not really anything else in that area that can touch it, I have them on “CanTouch” and “CanQuery” disabled. Only the lilpart and the wheel have them on.
local lilpart = script.Par ent.Hammer.lilpart
local WantedHit = "The path of the part you want the lilpart to hit"
lilpart.Touched:Connect(function(hit)
if hit == WantedHit then
script.Parent.HingeConstraint.MotorMaxTorque = 100000
end
end)
lilpart.TouchEnded:Connect(function(hit)
if hit == WantedHit then
script.Parent.HingeConstraint.MotorMaxTorque = 0
end
end)
The problem is, the game is saying the barrel is ALWAYS touching the lilpart (or vice-versa), the spike in the barrel is supposed to touch the hammer’s tail and set its motor’s torque, and then when it ends the touch, it sets the torque to 0.
local lilpart = script.Parent.Hammer.lilpart
local hits = {}
lilpart.Touched:Connect(function(hit)
if not table.find(hits, hit) then
table.insert(hits, hit)
script.Parent.HingeConstraint.MotorMaxTorque = 100000
end
end)
lilpart.TouchEnded:Connect(function(hit)
if table.find(hits, hit) then
table.remove(hits, table.find(hits, hit))
script.Parent.HingeConstraint.MotorMaxTorque = 0
end
end)
I think I have an idea, so is this like a music player or something? Is there an animation being played to move the littlepart onto the wheel? If so I think you can just edit the torque from there, then when you undo the animation you just undo the torque.
It’s not like a music player. The barrel is being moved by a HingeConstraint with a motor.
What is supposed to happen: When the spike on the barrel touches the lilpart(hammer’s tail), it is supposed to trigger the touched event for the hammer, change its maxtorque, then when it stops touching, it releases the hammer, making it strike the chime rod.
What seems to be happening: Chime barrel is apparently constantly touching the lilpart (or vice-versa).
Video demonstration of the chime barrel:
Using a HingeConstraint is one of the only ways to make this work, because touched events only work through physical movement.