How to make knock able streetlights?

How to make knock able streetlights not allowing player to knock them with their character only by a vehicle like car. I tried using welds but it allows any entity to knock it out. Whats best way to make one?

Try to detect when it’s a car touching the streetlight by using the .Touched event. If it is the car, then unanchor the streetlight (or whatever else you’re doing to knock it down).

You could try to use magnitude and check if the player is inside a car or not. For example it should check the distance between the front of the car and the streetlight.

Here is a rough idea of how it could be done:

game.Players.PlayerAdded:Connect(function(player)
	local playerInCar = Instance.new("BoolValue") -- creating a boolean to check wether the player is inside a car or not
	playerInCar.Name = "PlayerInCar"
	playerInCar.Value = false
	playerInCar.Parent = player
	
	playerInCar:GetPropertyChangedSignal("Value"):Connect(function() -- should fire whenever the player goes inside a car
		if playerInCar.Value == true then
			local streetlights = workspace.Streetlights:GetChildren()
			repeat
				for i, v in pairs(streetlights) do
					if v:IsA("Model") then
						local distance = (playerCar.Front.Position-v:GetPrimaryPartCFrame().p).magnitude
						if distance < 5 and carSpeed > 20 then -- check if the distance is lower than 5 studs and the speed of the car is over 20
							-- unanchor streetlight and make it fall to the direction where it is supposed to fall
						end
					end
				end
				wait(0.03)
			until playerInCar.Value == false
		end
	end)
end)

I hope this helps.

2 Likes