Touch event doesn't work when use tween

You can write your topic however you want, but you need to answer these questions:

  1. I want to make it print when it detects that the white part touch the red part so I can do stuff with it

  2. the issue is It’s doesn’t trigger the print function under the touch event and it doesn’t even make the red part fall

  3. I tired turning can collide off the white part and it doesn’t work. I tired turning can collide off the red part and it still doesn’t work. I anchor the red part it still doesn’t work.

The thing is that it work fine on my body. The script prints out the body part that touches the white part but it doesn’t do the same for the red part. I use local script
Edit:

  • Both parts are can collide
  • The script is in starterplayerscript
-- This is an example Lua code block
local superbig = game.Workspace:WaitForChild("SuperBig")
local superbigInv = game.Workspace.SuperBigInv

local tweenservice = game:GetService("TweenService")
local info = TweenInfo.new(60 , Enum.EasingStyle.Linear)
local goal = {Size = Vector3.new(0, 0, 1000)}
local tween = tweenservice:Create(superbig,info,goal)

tween:Play()

superbig.Touched:Connect(function(Touchingpart)
	print(Touchingpart)
end)

3 Likes

Make sure that the Local Script is under Services with Starter-[Gui, PlayerScripts, CharacterScript, Pack] called

local superbig = game.Workspace:WaitForChild("SuperBig")
local superbigInv = game.Workspace:WaitForChild("SuperBigInv")

local tweenservice = game:GetService("TweenService")
local info = TweenInfo.new(60 , Enum.EasingStyle.Linear)
local goal = {Size = Vector3.new(0, 0, 1000)}
local tween = tweenservice:Create(superbig,info,goal)

tween:Play()

superbig.Touched:Connect(function(Touchingpart)
	if Touchingpart:IsA("BasePart") then
               print(touchingPart)
               -- do your stuff here
        end
end)

And make sure the part that is getting inflated to have CanCollide on.

Try running into the part that is getting inflated and check if you can go through it. If yes maybe the CanCollide it’s the solution.

It’s in starterplayerscript that should be ok right?

Can collide is already on both of the part. And even I use the new script it still doesn’t work

1 Like

This is what you want?

robloxapp-20240110-1818044.wmv (52.2 KB)

If yes, then here are the properties of both parts in case you’re missing something out:

HERE is the script:

task.wait(5)

local superbig = game.Workspace.Folder:WaitForChild("InflatingPart")
local superbigInv = game.Workspace.Folder:WaitForChild("ToTouchPart")

local tweenservice = game:GetService("TweenService")
local info = TweenInfo.new(60 , Enum.EasingStyle.Linear)
local goal = {Size = Vector3.new(0, 1000, 1000)}
local tween = tweenservice:Create(superbig,info,goal)

tween:Play()

superbig.Touched:Connect(function(Touchingpart)
	if Touchingpart:IsA("BasePart") then
		print(Touchingpart)
		-- do your stuff here
	end
end)

Don’t mind the task.wait() function (you can delete it) and also change the :WaitForChild event location.