Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Player destroying blocks?

Asked by 10 years ago

I am making a Giant, Godzilla game and I had one question. How can I make it so I can stomp on bricks? Thank you.

2 answers

Log in to vote
1
Answered by 10 years ago

Use the Touched event on the legs and make it explode the part you touched. Example:

--leg is a part
leg.Touched:connect(function(oPart)
splode = Instance.new("Explosion", oPart)

end)
0
I'm sorry I am a beginner, but do I have to replace leg with right leg or something? collinman60 10 — 10y
1
yup, like game.Workspace.Godzilla.RightLeg or whatever it is figgycity50 70 — 10y
0
Thank you! collinman60 10 — 10y
Ad
Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

If you actually want to 'destroy' the blocks, I'd do something like this-

local Godzilla = Workspace.Godzilla -- Location of your Godzilla model

function BodyTouch(part)
    -- Code your method of 'destroying parts' here
    part.Anchored = false
    part:BreakJoints()
end

for _, obj in pairs(Godzilla:GetChildren()) do
    if obj:IsA("BasePart") then
        obj.Touched:connect(BodyTouch)
    end
end

Answer this question