You can write your topic however you want, but you need to answer these questions:
What do you want to achieve?
What I am trying to make is that when a vehicle hits a building, the building breaks.
What is the issue?
The problem I’m having with itis that it wont break the building when it is touched by a vehicle.
Script:
if script.Parent.Touched:Connect(function(hit)
if hit.Candestroy then
script.parent.Anchored = false
wait(10)
script.Parent.Anchored = true
script.Parent.CFrame = CFrame.new(pos)
script.Parent. Orientation = Vector3.new(orientation)
end
end)
What solutions have you tried so far?
I have tried doing some bug fixes but I havent been able to fix it
Thanks for reading.
Hi, it seems like you are new to scripting. Before making complex things like this, try perfecting functions and if statements. Here is a scripting tutorial I suggest you watch.
To point out your mistake, you have an incomplete if
statement right before the function. Also, you are missing the end for the second if statement:
LazedWithButterYT:
if hit.Candestroy then
wait you said it is touched by the vehicle and I suppose your vehicle is a model and the script is placed inside the model and you are calling script.Parent.Touched… Try indexing all the parts of the vehicle and then apply the touched event on each part
I have been putting it in all the parts of the vehicle
Opps, I didn’t see that when I was writing the script before thanks for telling me about that.
1 Like