Game Scripts Completely Broke out of Nowhere?

I have recently made two scripts that took me hours to make, when you combine the multiple bug and error fixes, I had to make in them. Now they’ve completely broken and neither work as intended. The script for the cart that attaches a new rope between the players Right Arm and the RopePart doesn’t work, and for the other script, it works, but the parts that are created are unanchored but stuck floating in the air.

There are no errors that specifically point out to what I did wrong. so how do I fix this?

`Game Link

Cart Script

local pp = script.Parent
local clicked = 0
local cooldown = false

pp.Triggered:Connect(function(player)
	if player.Name == pp.Parent:GetAttribute("Ownership") and clicked == 0 then
		if not cooldown then cooldown = true elseif cooldown then return end
		local transportVehicle = pp.Parent.Parent
		clicked += 1
		
		local playerChar = player.Character
		local RightArm = playerChar:FindFirstChild("Right Arm")

		local Rope = Instance.new("RopeConstraint", RightArm)
		Rope.Name = "Rope"
		Rope.Visible = true
		Rope.Attachment0 = Instance.new("Attachment", RightArm)
		Rope.Attachment0.Name = "RopeConstraintAttatchment"
		Rope.Attachment1 = Instance.new("Attachment", transportVehicle:WaitForChild("RopePart"))
		Rope.Attachment1.Name = "RopeConstraintAttatchment"
		
		task.wait(.558)
		
		cooldown = false
	elseif player.Name == pp.Parent:GetAttribute("Ownership") and clicked == 1 then
		if not cooldown then cooldown = true elseif cooldown then return end
		local transportVehicle = pp.Parent.Parent
		clicked -= 1
		
		local playerChar = player.Character
		local RightArm = playerChar:FindFirstChild("Right Arm")

		local Rope = RightArm:WaitForChild("Rope")
		Rope:Destroy()
		
		task.wait(.558)
		
		cooldown = false
	end
end)
  15:17:36.689  Workspace.Transporter.RopePart.AttatchRopeToPlayer.AttatchScript:33: attempt to index nil with 'WaitForChild'  -  Server - AttatchScript:33
  15:17:36.689  Stack Begin  -  Studio
  15:17:36.689  Script 'Workspace.Transporter.RopePart.AttatchRopeToPlayer.AttatchScript', Line 33  -  Studio - AttatchScript:33
  15:17:36.689  Stack End  -  Studio

Mineral Script

local tool = script.Parent
local toolDamage = tool:GetAttribute("Damage")
local guiElements = tool:WaitForChild("GUI")
local remote = tool:WaitForChild("RemoteEvent")
local RS = game:GetService("ReplicatedStorage")
local Blocks = RS:WaitForChild("Blocks")

remote.OnServerEvent:Connect(function(player, char, mineral)
	toolDamage = tool:GetAttribute("Damage")
	
	if mineral:FindFirstChild("Progress") and mineral:GetAttribute("damageDone") then
		print("true")
		local MaxHealth = mineral:GetAttribute("MaxHealth")
		local damageDone = mineral:GetAttribute("damageDone")
		print(mineral:GetAttribute("damageDone"))
		print(mineral:GetAttribute("MaxHealth"))
		
		print(damageDone)
		
		print(mineral.Size.X + mineral.Size.Y)
		mineral:SetAttribute("damageDone", damageDone + toolDamage)
		mineral:WaitForChild("Progress"):WaitForChild("ProgressBar").Size = UDim2.new(damageDone/MaxHealth, 0, 1, 0)
		
		if damageDone >= MaxHealth then
			for i = 1, mineral.Size.X do
				for index, block in pairs(Blocks:GetChildren()) do
					if block.Color == mineral.Color then
						local mineralPiece = block:Clone()
						mineralPiece.Parent = workspace:WaitForChild("MineralPieces")
						mineralPiece.Position = mineral.Position
						mineralPiece.Anchored = false
					end
				end
			end
			mineral:Destroy()
		end
		
	elseif not mineral:FindFirstChild("GUI") and mineral:GetAttribute("damageDone") then -- <--
		print("false")
		for i, v in pairs(guiElements:GetChildren()) do
			local guiClone = v:Clone()
			guiClone.Parent = mineral
			for ii, vv in pairs(guiClone:GetChildren()) do
				vv.BackgroundTransparency = 0
				vv.TextTransparency = 0
			end
		end
	end
end)
1 Like

Hello again! Lets start with the first script, it says that you cant index nil with waitForChild, meaning that the rightArm variable is nil, you could make it :WaitForChild('Right Arm') instead of :FindFirstChild("Right Arm"), if it still doesnt work, it could mean that you or someone in your team has changed the Avatar Type to R15, which doesnt have a “Right Arm”

Yeah I got that fixed by switching the game to R6, but the second is still having some issues.

What exactly doesnt work in the second script?

Well, the script works but, whenever the parts spawn in the workspace, they just float and never fall on the group, and when I tried moving them up, the parts just slowly and laggily fall to the group whenever I touch them, and I have a very good wifi network.

bump

15:23:53.817 Workspace.Transporter.MiningTool.MiningToolScript:32: attempt to index nil with ‘GetChildren’ - Server - MiningToolScript:32
15:23:53.817 Stack Begin - Studio
15:23:53.817 Script ‘Workspace.Transporter.MiningTool.MiningToolScript’, Line 32 - Studio - MiningToolScript:32
15:23:53.817 Stack End - Studio

Errors

I’m not really sure what’s wrong with my script.
I’ve tried to find the issue by myself, but I could not find it.
Help would be appreciated.

Thank you for your time,
-BlueWaffle

In the first script, you are creating a RopeConstraint on the RightArm, then you are creating an Attachment on the RopeConstraint. However, that doesn’t work because the Attachment can’t be on a RopeConstraint. It can only be on a Part.
So, change this:
Rope.Attachment0 = Instance.new(“Attachment”, RightArm)

To this:
Rope.Attachment0 = Instance.new(“Attachment”, RightArm.Parent)

In the second script, you are doing this:
for i, v in pairs(guiElements:GetChildren()) do

However, you have no GetChildren function, so you are trying to access GetChildren on a nil value.
You should change that to this:
for i, v in pairs(guiElements:GetChildren()) do