Tweening Model doesn't cause part to function

I was trying to make a part in an obby where if one of the spiked balls touched a portion of a bridge, it would fall off.


(sorry if the quality is bad)
The singular part makes the bridge fall, but the model doesn’t.

Script for the Models:

local TweenService = game:GetService("TweenService")
local debounce = false
local RotateSwingInfo1 = TweenInfo.new(0.9,Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false,0)
task.wait(10)
for i,v in pairs(workspace.SpikeBalls:GetChildren()) do
	if v:IsA("Model") then
		local Rotate1 = v
		local RotateRoot1 = v.PrimaryPart
		local PanelSwingTween = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
			CFrame = RotateRoot1.CFrame * CFrame.Angles(0,0, math.rad(90))})	
		PanelSwingTween.Completed:Connect(function()
			task.wait(math.random(1))
			local PanelSwingTween2 = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
				CFrame = RotateRoot1.CFrame * CFrame.Angles(0,0, math.rad(-90))})
			PanelSwingTween2:Play()
			PanelSwingTween2.Completed:Connect(function()
				task.wait(math.random(5,10))
				PanelSwingTween:Play()

			end)
		end)

		task.wait(math.random(5,10))
		PanelSwingTween:Play()
	end
end

Script for the Bridge:

local collectionservice = game:GetService('CollectionService')
local Bridge = collectionservice:GetTagged('Bridge')
local tweenservice = game:GetService('TweenService')
local Spikey = collectionservice:GetTagged('Spikey')
local db = false
local tinfo = TweenInfo.new(2,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false)
local tinfo2 = TweenInfo.new(0,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false)
for _, tagged in pairs(Bridge) do
	tagged.Touched:Connect(function(Part)
		if Part.Name == "HeadActivate" and db == false then
			db = true
			task.wait(0.5)
			local tween = tweenservice:Create(tagged,tinfo, {
				CFrame = tagged.CFrame * CFrame.new(0,-20,0)
			})
			tween:Play()
			print('AAAAAAAAA')
			tween.Completed:Connect(function()
				tagged.Transparency = 1
				task.wait(2)
				local tween2 = tweenservice:Create(tagged,tinfo2, {
					CFrame = tagged.CFrame * CFrame.new(0,20,0)
					
				})
				tween2:Play()
				tween2.Completed:Connect(function()
					tagged.Transparency = 0
				end)
			end)
			task.wait(1)
			db = true
		end
		
	end)
end

Screenshot 2023-07-01 200946

you don’t need to connect a touched function to every part of the bridge, you can just do the middle. And if what touches is a child of the wrecking ball then the bridge collapses.
This is also another way to connect a touch function if the former does not work.

local birdgepart= game.Workspace.bridgepart:GetTouchingParts()
for _, part in next, bridgepart do
		if part.Parent == WreckingBall  then -- substitute the wreckingball model for it 
        end
	end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.