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

Trying to Make Windows Only Breakable By Certian Object?

Asked by 6 years ago

I'm trying to make breakable windows, partly for my game, partly for a personal scripting challenge. My only problem is that I want to make it so that "Windows" must be touched by a bullet to move. Here's the script I have so far:

game.Workspace.Windows.Touched:Connect(function(Windows)
    Windows = script.Parent

Windows.Position = Vector3.new(-38, 0.5, 57)
end)

but, how do I make it so it must be touched by a bullet to break?

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

Something like this should work if the bullet is called Bullet:

game.Workspace.Windows.Touched:Connect(function(partThatTouched)
    if partThatTouched.Name == "Bullet" then
        Windows.CFrame = CFrame.new(-38, 0.5, 57)
    end
end)
0
Or if the window is anchored, just unanchor it. DatOneRandomDude 69 — 6y
Ad

Answer this question