Why have a lot of my if statments rndomly broken for no reason

PlaceSender.OnServerEvent:Connect(function(plr, Param, Type, RemFrom)
	print("Started")



	--Handling removed
	if Param == "Removed" then

		print(RemFrom)
		RemFrom.Taken.Value = false


		for _, PartAdded in pairs(Type:GetDescendants()) do
			if PartAdded:IsA("BasePart") then
				PartAdded.Massless = false
			end
		end

		if Type:FindFirstChild("ConnectionWeld") then
			print("Removing weld!")
			Type.ConnectionWeld:Destroy()
			if Type.Name == "BatInUse" then
				HasBat.Value = false
				Type.Name = "Battery"
			elseif Type.Name == "EngInUse" then
				HasEng.Value = false
				Type.Name = "Engine"
				Started = false
				StopWheels()
				Type.SoundPart.Loop:Stop()
				Type.SoundPart.Fail:Play()
			elseif Type.Name == "TankInUSe" then
				HasTank.Value = false
				Started = false
				StopWheels()
				Type.Name = "Tank"
				if HasEng.Value == true and Started == true then
					script.Parent.Parent:FindFirstChild("EngInUse").SoundPart.Loop:Stop()
					script.Parent.Parent:FindFirstChild("EngInUse").SoundPart.Fail:Play()
				end
			end

			Type.Parent = game.Workspace
		end

Litrally a few hours ago this was working fine. only diffrence i have is that a few hours ago it was
“if statmenet”
“If statement”
“If statment”
now i just made them all into 1 if statment with elseif, and yes i did try putting it back to be normal if statments, but that didnt work.

The only statement that works is the very top one, saying "If Type.Name == “BatInUse”
All the other statements do the exact same thing, just different name checks.

1 Like

First print all the parameter varaibles and u check whats wrong

hey dude, sorry i havnt been checking responses, i got it all figured out.
Thanks though!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.