i am making a feature where if the car touches the water it respawns in a boat
note this script is in the car touch block and it is line 14
local touch_block = script.Parent local car = script.Parent.Parent local car_transparency = car.transparency local respawn_boat_found = touch_block.trigger_respawn local touch = touch_block.Touched local boat_name = touch_block.what_boat_is_found local function respawn(boat) touch_block.Orientation = Vector3.new(0, 0, 0) boat_name.Value = boat.Parent.Name if boat_name.Value == "respawn_point" then boat_name.Value = game.Workspace.respawn_points.respawn_point_1 script.Parent.Parent.properties.can_be_damaged.Value = false car_transparency.Value = 1 touch_block.Size = Vector3.new(1, 1, 1) --repeat repeat wait(0.1) car_transparency.Value = car_transparency.Value + 1 until car_transparency.Value == 1 repeat wait(0.1) car_transparency.Value = car_transparency.Value - 1 until car_transparency.Value == 0 --until end end local function on_touch(other_part) if other_part.name == "boat" then print("found a boat") respawn_boat_found = true respawn() else warn("did not find boat") end end touch_block.trigger_script.Changed:Connect(function() if touch_block.trigger_script.Value == true then repeat wait(0.1) touch_block.Size = Vector3.new(touch_block.Size.X + 100, touch_block.Size.Y + 100, touch_block.Size.Z + 100) touch_block.Touched:Connect(on_touch) until respawn_boat_found == true end end)
On line 37, you have not put in other_part
as the tuple that you pass to the respawn()
function. Since there is no boat variable passed to it, the script doesn't know what to find the parent of.
Put respawn(other_part) instead of just respawn() on line 37.