Hello everyone! I am a beginner at scripting. I want to make, for example, a lamp post that can be broken by a car if it has enough velocity, but I have no idea how to do it. I just couldn’t find anything about velocity.
ManualWeld it, then when it is touched, if the hit’s velocity is high enough and it is part of the car, destroy the weld, unanchor the lamp (make it fall), then destroy the lamp.
Can you give me an example as a script?
local Lamp = workspace.Lamp -- model or something?? for _, v in pairs(Lamp:GetChildren()) do v.Touched:Connect(function(hit) if hit and hit:IsDescendantOf(the car model) and hit.Velocity == speedinstudspersecond then v:Destroy() end end) end
(I left out the weld part, but you can add it in if you want. Just remember, “v” means the part of the lamp)
For some reason it doesn’t work, I recorded a video, you can watch it.
Oops! Replace the velocity == 12 with
velocity == 12 or velocity > 12
Thanks very much!