Problem with tsunami

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

  1. What I want to achieve: I’m trying to make a tsunami, that will unanchor the part on impact and wait 10 seconds for it to be destroyed.

  2. What is the issue: Once it hits the brick I want it to unanchor it, but it doesn’t even react to it being touched! Here is the script I’m using:

script.Parent.Touched:Connect(function(hit)
	
	if hit.Parent:FindFirstChild("Humanoid") then
		
		hit.Parent.Humanoid.Health = 0
		
	end
	
	if hit:IsA("Part") and not hit.Name == "Water" then
		
		print("detected") --- It never prints this, but it does kill players.
		hit.Anchored = false
		wait(10)
		hit:Destroy()
		
	end
	
	
end)
  1. Solutions I have tried: I’ve tried searching it on google and on the Developer Forum.

It does move, I just haven’t included that part of the script.

you just have to have an elseif instead:

script.Parent.Touched:Connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") then
	
	hit.Parent.Humanoid.Health = 0

elseif hit:IsA("Part") and not hit.Name == "Water" then
	
	print("detected") --- It never prints this, but it does kill players.
	hit.Anchored = false
	wait(10)
	hit:Destroy()
	
end


end)

or maybe its a mesh part that you didn’t recognise

1 Like

The Touched event does not trigger for parts being moved with CFrame.

So i think you should put a script in serverstorage like this:
script.Parent.Anchored = false wait(10) script.Parent:Destroy()
and then on main script make the script clone on parts:
destroypart = game.ServerStorage.yourscriptname:Clone() destroypart.Parent = hit
So it’s like a virus that you insert in the part that will destroy them, i already did these type of things try this.

local TweenService = game:GetService("TweenService")
 
local part = script.Parent
 
local goal = {}
goal.Position = Vector3.new(-32.585, 244.228, -496.213)
 
local tweenInfo = TweenInfo.new(100)
 
local tween = TweenService:Create(part, tweenInfo, goal)

tween:Play()

That’s how I’m moving it.

If the tsunami you are moving is anchored, touched will not fire with use of Tween or moving via CFrame.

Does it move? Or that is another issue?

It does move.

[30CharacterLimit]

No i tested it in my game, it works

In my game i did a meteor disaster and by tweening explosion it worked on touched.
So the problem is another.

If it is anchored, it shouldn’t work. It needs to be detected by the physics engine.

1 Like

Will it still move correctly if I unanchor it? Because I could also unanchor the tsunami once it gets enabled.

1 Like

Wait i found the error i think try remove not and add ~=.

It did the same issue to me and by removing not and placing that symbol i fixed that.
elseif hit:IsA("BasePart") and hit.Name ~= "Water" then it can seem stupid but try.

I would use BodyMovers for this. With them, you can make the tsunami unanchored and can-collide false. I believe this is the method used in Natural Disaster Survival.

1 Like

try by add a .Parent to the Hit, your script should look like this:

script.Parent.Touched:Connect(function(hit)	
if hit.Parent:FindFirstChild("Humanoid") then
	hit.Parent.Humanoid.Health = 0
end

if hit:IsA("Part") and not hit.Name == "Water" then
	print("detected")
	hit.Parent.Anchored = false --See here
	wait(10)
	hit:Destroy()
end
end)

I don’t think this is the issue, because the parent of the part it hits is just the model the map is in.

1 Like

Try elseif hit:IsA("BasePart") and hit.Name ~= "Water" then it isn’t a bug of colliding because on player works the IF is the problem use that script cloning too.

Why you dont try by removing the and not hit.Name == “Water“, possibly its this the issue. If it print while you have removed this code snipped then you know that you muss edit this part.

3 Likes

the problem with this is that if your world has terrain the tsunami will hardly move