|
So I need some help. I’m trying to make a tsunami that moves across the map by CFraming, and destroys everything in its path. I’ve got the movement down but I can’t seem to figure out how to make it unanchor any parts it touches AND kill any players it touches. The farthest I’ve gotten is it moves through the map, not destroying anything, but when it touches a player all of the sudden every part it’s now touching unanchors. Hope you understand what I’m trying to say. Anyone know how to solve this? |
|
ChrounumJoin Date: 2015-04-04 Post Count: 2911 |
Well, Parts have a .Anchored Property, so set that to false, and also Either call :BreakJoints() on the model that the Tsunami touches, or find the Humanoid and set it's Health to Its health - its max health
#code print("don't forget to dry the towel after use") |
|
|
Ok I'll try that and let you know what happens. Thanks! |
|
|
Ok so this is my script:
------------------------------------------------------------------------------------
local function WaveTouchPart(hit)
while wait(.1) do
if not hit.Parent:GetChildren("Humanoid") then
local parts = script.Parent:GetTouchingParts()
for i, part in pairs(parts) do
if part.Name == "Part" and part.Anchored then
part.Anchored = false
end
end
else
hit.Parent.Humanoid.Health = 0
end
end
end
script.Parent.Touched:connect(WaveTouchPart)
------------------------------------------------------------------------------------
Now it only kills the player but does not unanchor any parts. Please keep in mind that I am a beginner scripter and am gonna need some help. XD |
|
ChrounumJoin Date: 2015-04-04 Post Count: 2911 |
I'm going to assume that the script is inside the wave.
script.Parent.Touched:Connect(function(hit)
local Human = Hit.Parent:FindFirstChild("Humanoid")
if Human ~= nil then
Human.Health = Human.Health - Human.MaxHealth
end
hit:BreakJoints()
end)
Hopeflly that works.
#code print("don't forget to dry the towel after use") |
|
|
No it did not work. The city I'm trying to destroy is just a bunch of parts all in one model, is that the problem? |
|
ChrounumJoin Date: 2015-04-04 Post Count: 2911 |
Yea, hold on, I'll re-write it.
script.Parent.Touched:Connect(function(hit)
if hit.Parent:IsA("Model") then
for i,v in pairs(hit.Parent:GetChildren()) do
v:BreakJoints()
end
end
local Human hit.Parent:FindFirstChild("Humanoid")
if Human ~= nil then
Human.Health = Human.Health - Human.MaxHealth
end
end)
#code print("don't forget to dry the towel after use") |
|
|
That didn't work either. It does the same except this time it breaks the joints of the player to so your still alive just you don't have legs or arms lol. Tricky isn't it? |
|
|
ChrounumJoin Date: 2015-04-04 Post Count: 2911 |
I feel like the answer is obvious but im not noticing it.
#code print("don't forget to dry the towel after use") |
|
|
|
Maybe we could get some extra help. I'm gonna post this on script helpers and see if they can help then post the results here. |
|