Issues with, attempt to index nil with 'Name' - Vector3 remote function

buddy that started this game with me left for college i been banging my head against the wall with it for 4 days now, allways end up with nil and name. I have been trying to understand his local script with the best of knowledge and understanding.
image


been able to get the tower to Cursor position with the range and hitbox but i cant get nil to name out of the equation to place the tower

server


game.ReplicatedStorage.Events.PlaceTower.OnServerInvoke = function(player, u2, v26, u1)
	print("Type of u2 is:", type(u2))
	print("typeof() u2 is:", typeof(u2))
	print("Type of v26 is:", type(v26))
	print("typeof() v26 is:", typeof(v26))
	print("Type of u1 is:", type(u1))
	print("typeof() u1 is:", typeof(u1))
	
	local place = game.player.PlayerGui.ScreenGui.Placing.Value
	local price = require(game.ReplicatedStorage.TowerStorage[place]).StarterStats.Price
	
	if player.Cash.Value >= price then
		player.Cash.Value = player.Cash.Value - price
		
		local mouse = player:GetMouse()	
		
		
		u2 = mouse 
		place:Clone()
		
		return mouse
		
		
	end
end

local

script.Parent.Visible = false;
wait(2);
script.Parent.Visible = true;
local v1 = require(game.ReplicatedStorage.ModuleStorage.UI.RangeSelection);
local v2 = false;
local l__UserInputService__3 = game:GetService("UserInputService");
function mousepos(p1)
	local l__mouse__4 = game.Players.LocalPlayer:GetMouse();
	local v5, v6, v7, v8 = workspace:FindPartOnRayWithIgnoreList(Ray.new(l__mouse__4.UnitRay.Origin, l__mouse__4.UnitRay.Direction * 900), p1);
	return v5, v6, v7, v8;
end;
if l__UserInputService__3.TouchEnabled and not l__UserInputService__3.KeyboardEnabled and not l__UserInputService__3.MouseEnabled and not l__UserInputService__3.GamepadEnabled and not game:GetService("GuiService"):IsTenFootInterface() then
	v2 = true;
end;
if v2 == true then
	script.Parent.Parent.Parent.Selection.Visible = false;
	script.Parent.Parent.Position = UDim2.new(0.5, 0, 1, 0);
	script.Parent.Parent.AnchorPoint = Vector2.new(0.5, 1);
	script.Parent.Parent.Cash.Position = UDim2.new(0.95, 0, 0.92, 0);
	script.Parent.Parent.Parent.Messages.Frame.Position = UDim2.new(0, 0, 0.5, 0);
	script.Parent.Parent.Parent.Dialog.Position = UDim2.new(0.5, 0, 0.775, 0);
	script.Parent.Parent.Upgrade.Position = UDim2.new(-0.04, 0, 0.07, 0);
	script.Parent.Parent.Abilities.Position = UDim2.new(1.43, 0, 0.8, 0);
	script.Parent.Parent.Abilities.Size = UDim2.new(0.125, 0, 0.73, 0);
	script.Parent.Parent.Abilities.UIListLayout.FillDirection = Enum.FillDirection.Vertical;
end;
script.Parent.Visible = true;
function tween(p2, p3, p4, p5, p6, p7)
	local v9 = game:GetService("TweenService"):Create(p2, TweenInfo.new(p4, p5, p6, 0, p7, 0), p3);
	v9:Play();
	return v9;
end;
script.Parent.Parent.Upgrade.Mover.Position = UDim2.new(0, 0, 1, 0);
function update()
	local v10, v11, v12 = pairs(script.Parent:GetChildren());
	while true do
		local v13, v14 = v10(v11, v12);
		if v13 then

		else
			break;
		end;
		v12 = v13;
		if v14:IsA("Frame") then
			if workspace.Game.GameStats.ChallengeOptions.ForcedTower:GetAttribute("Slot" .. v14.Name) ~= nil then
				local v15 = workspace.Game.GameStats.ChallengeOptions.ForcedTower:GetAttribute("Slot" .. v14.Name);
			else
				v15 = game.Players.LocalPlayer:WaitForChild("TowersChosen"):WaitForChild("Slot" .. v14.Name).Value;
			end;
			if v15 == "Locked" then
				v14.Locked.Visible = true;
				v14.Frame.Icon.ImageLabel.Image = "rbxassetid://4797141005";
				v14.Frame.Icon.ImageLabel.ImageColor3 = Color3.new(0, 0, 0);
				v14.Frame.Icon.ImageLabel.ImageTransparency = 0.2;
				v14.Frame.TextLabel.Text = "";
			elseif v15 ~= "" then
				if game.ReplicatedStorage.TowerStorage:FindFirstChild(v15) == nil then
					v14.Frame.Icon.ImageLabel.Image = "rbxassetid://4797141005";
					v14.Frame.Icon.ImageLabel.ImageColor3 = Color3.new(0, 0, 0);
					v14.Frame.Icon.ImageLabel.ImageTransparency = 0.2;
					v14.Frame.TextLabel.Text = "";
				else
					v14.Frame.Icon.ImageLabel.Image = "rbxassetid://" .. require(game.ReplicatedStorage.TowerStorage[v15]).StarterStats.Icon;
					local v16 = require(game.ReplicatedStorage.TowerStorage[v15]).StarterStats.Price;
					local v17, v18, v19 = pairs(game.ReplicatedStorage.TowerStorage[v15].StatAdjustments:GetChildren());
					while true do
						local v20, v21 = v17(v18, v19);
						if v20 then

						else
							break;
						end;
						v19 = v20;
						local l__StarterLevel__22 = require(v21).StarterLevel;
						if l__StarterLevel__22.Price ~= nil then
							if l__StarterLevel__22.Price.Set ~= nil then
								v16 = l__StarterLevel__22.Price.Set;
							elseif l__StarterLevel__22.Price ~= nil then
								if l__StarterLevel__22.Price.Increment ~= nil then
									v16 = v16 + l__StarterLevel__22.Price.Increment;
								end;
							end;
						elseif l__StarterLevel__22.Price ~= nil then
							if l__StarterLevel__22.Price.Increment ~= nil then
								v16 = v16 + l__StarterLevel__22.Price.Increment;
							end;
						end;					
					end;
					v14.Frame.TextLabel.Text = "$" .. v16;
					if require(game.ReplicatedStorage.TowerStorage[v15]).StarterStats.Icon == 6275912827 then
						v14.Frame.Icon.ImageLabel.Position = UDim2.new(0.5, 0, 0.5, 0);
						v14.Frame.Icon.ImageLabel.Size = UDim2.new(1.15, 0, 1.15, 0);
					elseif require(game.ReplicatedStorage.TowerStorage[v15]).StarterStats.Icon == 6275912376 then
						v14.Frame.Icon.ImageLabel.Position = UDim2.new(0.5, 0, 0.6, 0);
						v14.Frame.Icon.ImageLabel.Size = UDim2.new(1.125, 0, 1.125, 0);
					else
						v14.Frame.Icon.ImageLabel.Position = UDim2.new(0.5, 0, 0.6, 0);
						v14.Frame.Icon.ImageLabel.Size = UDim2.new(1.25, 0, 1.25, 0);
					end;
				end;
			else
				v14.Frame.Icon.ImageLabel.Image = "rbxassetid://4797141005";
				v14.Frame.Icon.ImageLabel.ImageColor3 = Color3.new(0, 0, 0);
				v14.Frame.Icon.ImageLabel.ImageTransparency = 0.2;
				v14.Frame.TextLabel.Text = "";
			end;
		end;	
	end;
end;
update();
spawn(function()
	while wait(3) do
		update();	
	end;
end);
function commaval(p8)
	local v23 = p8;
	while true do
		local v24, v25 = string.gsub(v23, "^(-?%d+)(%d%d%d)", "%1,%2");
		v23 = v24;
		if v25 ~= 0 then

		else
			break;
		end;	
	end;
	return v23;
end;
script.Parent.Parent.ImageLabel.Cash.Text = "$" .. commaval(game.Players.LocalPlayer.Cash.Value);
script.Parent.Parent.ImageLabel.Cash.TextStroke.Text = "$" .. commaval(game.Players.LocalPlayer.Cash.Value);
game.Players.LocalPlayer.Cash.Changed:Connect(function()
	script.Parent.Parent.ImageLabel.Cash.Text = "$" .. commaval(game.Players.LocalPlayer.Cash.Value);
	script.Parent.Parent.ImageLabel.Cash.TextStroke.Text = "$" .. commaval(game.Players.LocalPlayer.Cash.Value);
end);
local v26 = require(script.SpringModule).new(Vector3.new());
v26.Speed = 30;
v26.Damper = 0.8;
local u1 = 0;
local u2 = nil;
local u3 = 0;
function placingability(p9, p10, p11)
	u1 = 0;
	game.Players.LocalPlayer.PlayerGui.ScreenGui.ChangeSelector:Fire(nil);
	if u2 ~= nil then
		u2:Destroy();
		u2 = nil;
	end;
	script.Parent.Parent.Parent.Placing.Value = "";
	local v27, v28, v29 = pairs(workspace.Game.Towers:GetChildren());
	while true do
		local v30, v31 = v27(v28, v29);
		if v30 then

		else
			break;
		end;
		v29 = v30;
		pcall(function()
			if v31.PrimaryPart ~= nil then
				v31.PrimaryPart.Transparency = 0.8;
				v31.PrimaryPart.Color = v1.RangeColor;
				v31.PrimaryPart.FrontSurface = Enum.SurfaceType.Smooth;
				if v31:FindFirstChild("Selection") == nil then
					local v32 = Instance.new("SelectionBox", v31);
					v32.Color3 = v1.RangeColor;
					v32.LineThickness = 0.025;
					v32.Name = "Selection";
					v32.Adornee = v31.PrimaryPart;
				end;
				v31.Selection.Visible = true;
				tween(v31.Range, {
					Transparency = 1
				}, 0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, false);
			end;
		end);	
	end;
	u2 = p10:Clone();
	u2.Parent = workspace.Game.Projectiles;
	local v33, v34 = mousepos({ workspace.Game.Enemies, workspace.Game.Towers, workspace.Game.Projectiles, workspace.Game.Players, workspace.Game.Map.Paths, workspace.Game.Units });
	u3 = 0;
	u1 = 0;
	u2.PrimaryPart.CFrame = CFrame.new(v34) * CFrame.new(0, u2.PrimaryPart.Size.Y / 2, 0);
	v26.Position = v34;
	u2.Owner.Value = p11;
	u2.AbilityName.Value = p9;
end;
script.Parent.AbilityMousePos.Event:Connect(function(p12, p13, p14)
	script.Parent.Parent.Upgrade.Mover:TweenPosition(UDim2.new(0, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5);
	placingability(p12, p13, p14);
end);
function placing(p15)
	u1 = 0;
	local v35 = require(game.ReplicatedStorage.TowerStorage[p15]);
	script.Parent.Parent.Parent.Placing.Value = p15;
	if v2 == true then
		script.Parent.Parent.Parent.placingwhat.Visible = true;
		script.Parent.Parent.Parent.Trash.Visible = true;
		script.Parent.Parent.Parent.placingwhat.Text = "Placing " .. v35.StarterStats.DisplayName;
		script.Parent.Parent.Parent.Dialog.Visible = false;
		script.Parent.Parent.Parent.Messages.Visible = false;
	end;
	game.Players.LocalPlayer.PlayerGui.ScreenGui.ChangeSelector:Fire(nil);
	local v36, v37, v38 = pairs(workspace.Game.Towers:GetChildren());
	while true do
		local v39, v40 = v36(v37, v38);
		if v39 then

		else
			break;
		end;
		v38 = v39;
		pcall(function()
			if v40.PrimaryPart ~= nil then
				v40.PrimaryPart.Transparency = 0.8;
				v40.PrimaryPart.Color = v1.RangeColor;
				v40.PrimaryPart.FrontSurface = Enum.SurfaceType.Smooth;
				if v40:FindFirstChild("Selection") == nil then
					local v41 = Instance.new("SelectionBox", v40);
					v41.Color3 = v1.RangeColor;
					v41.LineThickness = 0.025;
					v41.Name = "Selection";
					v41.Adornee = v40.PrimaryPart;
				end;
				v40.Selection.Visible = true;
			end;
		end);	
	end;
	if u2 ~= nil then
		u2:Destroy();
		u2 = nil;
	end;
	if game.Players.LocalPlayer.TowersBought:FindFirstChild(p15) ~= nil then
		if game.Players.LocalPlayer.TowersBought[p15].SelectedSkin.Value == "Default" then
			u2 = game.ReplicatedStorage.TowerStorage[p15].Client:Clone();
		else
			u2 = game.ReplicatedStorage.TowerStorage[p15].Skins[game.Players.LocalPlayer.TowersBought[p15].SelectedSkin.Value].Client:Clone();
		end;
	else
		u2 = game.ReplicatedStorage.TowerStorage[p15].Client:Clone();
	end;
	u2.Parent = workspace.Game.Projectiles;
	u2.Name = p15;
	u2.Hitbox.FrontSurface = Enum.SurfaceType.Smooth;
	u2.PrimaryPart.Color = v1.IncorrectColor;
	local v42 = Instance.new("Part", u2);
	v42.Name = "RealHitbox";
	v42.Size = u2.Hitbox.Size * 0.9;
	v42.Transparency = 1;
	v42.Anchored = true;
	v42.CanCollide = false;
	local v43 = Instance.new("SelectionBox", u2.Hitbox);
	v43.Color3 = v1.RangeColor;
	v43.LineThickness = 0.025;
	v43.Name = "Selection";
	v43.Visible = true;
	v43.Adornee = u2.Hitbox;
	u2.Hitbox.Transparency = 0.5;
	local v44, v45, v46 = pairs(u2:GetDescendants());
	while true do
		local v47, v48 = v44(v45, v46);
		if v47 then

		else
			break;
		end;
		v46 = v47;
		if v48.Name ~= "P1L1" then
			if v48.Name ~= "P1L2" then
				if v48.Name ~= "P1L3" then
					if v48.Name ~= "P1L4" then
						if v48.Name ~= "P2L1" then
							if v48.Name ~= "P2L2" then
								if v48.Name ~= "P2L3" then
									if v48.Name == "P2L4" then
										if v48:GetAttribute("MakeInvisible") ~= true then
											v48:Destroy();
										end;
									elseif v48:IsA("BasePart") then
										v48.CanCollide = false;
										v48.Anchored = false;
										v48.Massless = true;
									end;
								elseif v48:GetAttribute("MakeInvisible") ~= true then
									v48:Destroy();
								end;
							elseif v48:GetAttribute("MakeInvisible") ~= true then
								v48:Destroy();
							end;
						elseif v48:GetAttribute("MakeInvisible") ~= true then
							v48:Destroy();
						end;
					elseif v48:GetAttribute("MakeInvisible") ~= true then
						v48:Destroy();
					end;
				elseif v48:GetAttribute("MakeInvisible") ~= true then
					v48:Destroy();
				end;
			elseif v48:GetAttribute("MakeInvisible") ~= true then
				v48:Destroy();
			end;
		elseif v48:GetAttribute("MakeInvisible") ~= true then
			v48:Destroy();
		end;	
	end;
	local v49 = Instance.new("Part", u2);
	v49.Name = "Range";
	v49.Size = Vector3.new(1, 1, 1) / 10;
	v49.Transparency = 1;
	local v50 = Instance.new("CylinderHandleAdornment", v49);
	v50.Adornee = v49;
	v50.Color3 = v1.RangeColor;
	v50.Transparency = 0.5;
	v50.Height = 0.3;
	v50.InnerRadius = 2;
	v50.Radius = 2;
	v50.Angle = 360;
	tween(v50, {
		Radius = game.ReplicatedStorage.TowerStorage[p15].Tower:GetAttribute("Range") / 2
	}, 0.6, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, false);
	v49.Anchored = true;
	v49.CanCollide = false;
	v49.CFrame = u2.PrimaryPart.CFrame * CFrame.new(0, -u2.PrimaryPart.Size.Y / 2, 0) * CFrame.Angles(math.rad(90), 0, 0);
	if game.Players.LocalPlayer.TowersBought:FindFirstChild(p15) == nil then
		u2.VisualCharacter.AnimationController:LoadAnimation(game.ReplicatedStorage.TowerStorage[p15].Tower.Configuration.Animations.IdleAnimation):Play(0);
	elseif game.Players.LocalPlayer.TowersBought[p15].SelectedSkin.Value ~= "Default" then
		u2.VisualCharacter.AnimationController:LoadAnimation(game.ReplicatedStorage.TowerStorage[p15].Skins[game.Players.LocalPlayer.TowersBought[p15].SelectedSkin.Value].Tower.Configuration.Animations.IdleAnimation):Play(0);
	else
		u2.VisualCharacter.AnimationController:LoadAnimation(game.ReplicatedStorage.TowerStorage[p15].Tower.Configuration.Animations.IdleAnimation):Play(0);
	end;
	local v51, v52 = mousepos({ workspace.Game.Enemies, workspace.Game.Towers, workspace.Game.Projectiles, workspace.Game.Players, workspace.Game.Map.Paths, workspace.Game.Units });
	u3 = 0;
	u1 = 0;
	u2.PrimaryPart.CFrame = CFrame.new(v52) * CFrame.new(0, u2.PrimaryPart.Size.Y / 2, 0);
	v26.Position = v52;
end;
function doneplacing(p16)
	if p16 == true then
		if u2 ~= nil then
			if u2.Parent ~= nil then

			else
				if p16 == false then
					u1 = 0;
					u2:Destroy();
					u2 = nil;
					script.Parent.Parent.Parent.Placing.Value = "";
					script.Parent.Parent.Parent.Selection.PlacingTower.Visible = false;
					script.Parent.Parent.Parent.placingwhat.Visible = false;
					script.Parent.Parent.Parent.Trash.Visible = false;
					script.Parent.Parent.Parent.Dialog.Visible = true;
					script.Parent.Parent.Parent.Messages.Visible = true;
					local v53, v54, v55 = pairs(workspace.Game.Towers:GetChildren());
					while true do
						local v56, v57 = v53(v54, v55);
						if v56 then

						else
							break;
						end;
						v55 = v56;
						pcall(function()
							if v57.PrimaryPart ~= nil then
								v57.PrimaryPart.Transparency = 1;
								if v57:FindFirstChild("Selection") ~= nil then
									v57.Selection.Visible = false;
								end;
							end;
						end);					
					end;
				end;
				return;
			end;
		else
			if p16 == false then
				u1 = 0;
				u2:Destroy();
				u2 = nil;
				script.Parent.Parent.Parent.Placing.Value = "";
				script.Parent.Parent.Parent.Selection.PlacingTower.Visible = false;
				script.Parent.Parent.Parent.placingwhat.Visible = false;
				script.Parent.Parent.Parent.Trash.Visible = false;
				script.Parent.Parent.Parent.Dialog.Visible = true;
				script.Parent.Parent.Parent.Messages.Visible = true;
				v53, v54, v55 = pairs(workspace.Game.Towers:GetChildren());
				while true do
					v56, v57 = v53(v54, v55);
					if v56 then

					else
						break;
					end;
					v55 = v56;
					pcall(function()
						if v57.PrimaryPart ~= nil then
							v57.PrimaryPart.Transparency = 1;
							if v57:FindFirstChild("Selection") ~= nil then
								v57.Selection.Visible = false;
							end;
						end;
					end);				
				end;
			end;
			return;
		end;
	else
		if p16 == false then
			u1 = 0;
			u2:Destroy();
			u2 = nil;
			script.Parent.Parent.Parent.Placing.Value = "";
			script.Parent.Parent.Parent.Selection.PlacingTower.Visible = false;
			script.Parent.Parent.Parent.placingwhat.Visible = false;
			script.Parent.Parent.Parent.Trash.Visible = false;
			script.Parent.Parent.Parent.Dialog.Visible = true;
			script.Parent.Parent.Parent.Messages.Visible = true;
			v53, v54, v55 = pairs(workspace.Game.Towers:GetChildren());
			while true do
				v56, v57 = v53(v54, v55);
				if v56 then

				else
					break;
				end;
				v55 = v56;
				pcall(function()
					if v57.PrimaryPart ~= nil then
						v57.PrimaryPart.Transparency = 1;
						if v57:FindFirstChild("Selection") ~= nil then
							v57.Selection.Visible = false;
						end;
					end;
				end);			
			end;
		end;
		return;
	end;
	local v58 = 0;
	local v59, v60, v61 = pairs(workspace.Game.Towers:GetChildren());
	while true do
		local v62, v63 = v59(v60, v61);
		if v62 then

		else
			break;
		end;
		v61 = v62;
		if v63.Name == u2.Name then
			if v63.Configuration.Owner.Value == game.Players.LocalPlayer then
				v58 = v58 + 1;
			end;
		end;	
	end;
	local v64 = 0;
	local v65, v66, v67 = pairs(workspace.Game.Towers:GetChildren());
	while true do
		local v68, v69 = v65(v66, v67);
		if v68 then

		else
			break;
		end;
		v67 = v68;
		if v69.Configuration.Owner.Value == game.Players.LocalPlayer then
			v64 = v64 + 1;
		end;	
	end;
	if u2.PrimaryPart.Color == v1.IncorrectColor then
		script.Error:Play();
		script.Parent.Parent.Parent.ErrorMSG:Fire("You cannot place here");
		return;
	end;
	if u2:FindFirstChild("RealHitbox") == nil then
		script.Parent.Parent.Parent.Selection.PlacingTower.Visible = false;
		script.Parent.Parent.Parent.placingwhat.Visible = false;
		script.Parent.Parent.Parent.Trash.Visible = false;
		script.Parent.Parent.Parent.Placing.Value = "";
		script.Parent.Parent.Parent.Dialog.Visible = true;
		script.Parent.Parent.Parent.Messages.Visible = true;
		local v70, v71 = mousepos({ workspace.Game.Enemies, workspace.Game.Towers, workspace.Game.Projectiles, workspace.Game.Players, workspace.Game.Map.Paths });
		game.ReplicatedStorage.Events.Ability:FireServer(u2.Owner.Value, u2.AbilityName.Value, v71);
		local l__Name__72 = u2.Name;
		u2:Destroy();
		u2 = nil;
		local v73, v74, v75 = pairs(workspace.Game.Towers:GetChildren());
		while true do
			local v76, v77 = v73(v74, v75);
			if v76 then

			else
				break;
			end;
			v75 = v76;
			pcall(function()
				if v77.PrimaryPart ~= nil then
					v77.PrimaryPart.Transparency = 1;
					v77.PrimaryPart.Color = v1.RangeColor;
					if v77:FindFirstChild("Selection") ~= nil then
						v77.Selection.Visible = false;
					end;
				end;
			end);		
		end;
		return;
	end;
	if game.Players.LocalPlayer.Cash.Value < require(game.ReplicatedStorage.TowerStorage[u2.Name]).StarterStats.Price then
		script.Error:Play();
		script.Parent.Parent.Parent.ErrorMSG:Fire("Not enough money");
		script.Parent.Parent.Parent.Placing.Value = "";
		u2:Destroy();
		u2 = nil;
		u1 = 0;
		script.Parent.Parent.Parent.Selection.PlacingTower.Visible = false;
		script.Parent.Parent.Parent.placingwhat.Visible = false;
		script.Parent.Parent.Parent.Trash.Visible = false;
		script.Parent.Parent.Parent.Dialog.Visible = true;
		script.Parent.Parent.Parent.Messages.Visible = true;
		local v78, v79, v80 = pairs(workspace.Game.Towers:GetChildren());
		while true do
			local v81, v82 = v78(v79, v80);
			if v81 then

			else
				break;
			end;
			v80 = v81;
			pcall(function()
				if v82.PrimaryPart ~= nil then
					v82.PrimaryPart.Transparency = 1;
					v82.PrimaryPart.Color = v1.RangeColor;
					if v82:FindFirstChild("Selection") ~= nil then
						v82.Selection.Visible = false;
					end;
				end;
			end);		
		end;
		return;
	end;
	if require(game.ReplicatedStorage.TowerStorage[u2.Name]).StarterStats.TowerLimit ~= 0 then
		if require(game.ReplicatedStorage.TowerStorage[u2.Name]).StarterStats.TowerLimit <= v58 then
			script.Error:Play();
			script.Parent.Parent.Parent.ErrorMSG:Fire("Max limit reached (" .. require(game.ReplicatedStorage.TowerStorage[u2.Name]).StarterStats.TowerLimit .. ")");
			script.Parent.Parent.Parent.Placing.Value = "";
			u2:Destroy();
			u2 = nil;
			u1 = 0;
			script.Parent.Parent.Parent.Selection.PlacingTower.Visible = false;
			script.Parent.Parent.Parent.placingwhat.Visible = false;
			script.Parent.Parent.Parent.Trash.Visible = false;
			script.Parent.Parent.Parent.Dialog.Visible = true;
			script.Parent.Parent.Parent.Messages.Visible = true;
			local v83, v84, v85 = pairs(workspace.Game.Towers:GetChildren());
			while true do
				local v86, v87 = v83(v84, v85);
				if v86 then

				else
					break;
				end;
				v85 = v86;
				pcall(function()
					if v87.PrimaryPart ~= nil then
						v87.PrimaryPart.Transparency = 1;
						v87.PrimaryPart.Color = v1.RangeColor;
						if v87:FindFirstChild("Selection") ~= nil then
							v87.Selection.Visible = false;
						end;
					end;
				end);			
			end;
			return;
		end;
	end;
	if workspace.Game.GameStats.ChallengeOptions:GetAttribute("TowerLimit") ~= nil then
		if workspace.Game.GameStats.ChallengeOptions:GetAttribute("TowerLimit") <= v64 then
			script.Error:Play();
			script.Parent.Parent.Parent.ErrorMSG:Fire("Max total limit reached (" .. workspace.Game.GameStats.ChallengeOptions:GetAttribute("TowerLimit") .. ")");
			script.Parent.Parent.Parent.Placing.Value = "";
			u2:Destroy();
			u2 = nil;
			u1 = 0;
			script.Parent.Parent.Parent.Selection.PlacingTower.Visible = false;
			script.Parent.Parent.Parent.placingwhat.Visible = false;
			script.Parent.Parent.Parent.Trash.Visible = false;
			script.Parent.Parent.Parent.Dialog.Visible = true;
			script.Parent.Parent.Parent.Messages.Visible = true;
			local v88, v89, v90 = pairs(workspace.Game.Towers:GetChildren());
			while true do
				local v91, v92 = v88(v89, v90);
				if v91 then

				else
					break;
				end;
				v90 = v91;
				pcall(function()
					if v92.PrimaryPart ~= nil then
						v92.PrimaryPart.Transparency = 1;
						v92.PrimaryPart.Color = v1.RangeColor;
						if v92:FindFirstChild("Selection") ~= nil then
							v92.Selection.Visible = false;
						end;
					end;
				end);			
			end;
			return;
		end;
	end;
	local v93, v94, v95, v96 = mousepos({ workspace.Game.Enemies, workspace.Game.Towers, workspace.Game.Projectiles, workspace.Game.Players, workspace.Game.Map.Paths, workspace.Game.Units });
	v26.Target = v94;
	local v97 = false;
	u2.Hitbox.CFrame = CFrame.new(v26.Position) * CFrame.new(0, u2.Hitbox.Size.Y / 2, 0) * CFrame.Angles(0, math.rad(u3), 0);
	u2.RealHitbox.CFrame = CFrame.new(v26.Position) * CFrame.new(0, u2.Hitbox.Size.Y / 2, 0) * CFrame.Angles(0, math.rad(u3), 0);
	local v98, v99, v100 = pairs((gettouching(u2.RealHitbox)));
	while true do
		local v101, v102 = v98(v99, v100);
		if v101 then

		else
			break;
		end;
		v100 = v101;
		if v102.Name ~= "Baseplate" then
			if v102.Name ~= "InfiniteBaseplate" then
				if v102.Parent ~= workspace.Game.Map then
					if v102:IsDescendantOf(workspace.Game.Map.Unplaceable) then
						v97 = true;
					elseif v102:IsDescendantOf(workspace.Game.Towers) then
						if v102.Name == "Hitbox" then
							if v102.Parent.Name == "Server" then
								v97 = true;
							end;
						end;
					end;
				end;
			end;
		end;	
	end;
	if v96 == Enum.Material.Water then
		v97 = true;
	end;
	if v93 ~= nil then
		if v97 ~= true then
			if v93:IsDescendantOf(workspace.Game.Map.Unplaceable) then
				script.Error:Play();
				script.Parent.Parent.Parent.ErrorMSG:Fire("You cannot place here");
				return;
			end;
		else
			script.Error:Play();
			script.Parent.Parent.Parent.ErrorMSG:Fire("You cannot place here");
			return;
		end;
	else
		script.Error:Play();
		script.Parent.Parent.Parent.ErrorMSG:Fire("You cannot place here");
		return;
	end;
	script.Parent.Parent.Parent.Selection.PlacingTower.Visible = false;
	script.Parent.Parent.Parent.placingwhat.Visible = false;
	script.Parent.Parent.Parent.Trash.Visible = false;
	script.Parent.Parent.Parent.Placing.Value = "";
	u2:Destroy();
	u2 = nil;
	script.Parent.Parent.Parent.Dialog.Visible = true;
	script.Parent.Parent.Parent.Messages.Visible = true;
	-----------------------
----line 668	
	print("Type of u2.Name is:", type(u2.Name))
	print("typeof() u2.Name is:", typeof(u2.Name))
	print("Type of v26.Position is:", type(v26.Position))
	print("typeof() v26.Position is:", typeof(v26.Position))
	print("Type of u1 is:", type(u1))
	print("typeof() u1 is:", typeof(u1))
	
	-----------------------------
	local v103 = game.ReplicatedStorage.Events.PlaceTower:InvokeServer(u2.Name, v26.Position, u1);

-------------------------------------------=
	--local v103 = game.ReplicatedStorage.Events.PlaceTower:InvokeServer(u2.Name, v26.Position, u1);
	u1 = 0;
	if v103 ~= nil then
		script.Place:Play();
		script.Parent.Parent.Parent.CurrentSelection.Value = v103;
	end;
	local v104, v105, v106 = pairs(workspace.Game.Towers:GetChildren());
	while true do
		local v107, v108 = v104(v105, v106);
		if v107 then

		else
			break;
		end;
		v106 = v107;
		pcall(function()
			if v108.PrimaryPart ~= nil then
				v108.PrimaryPart.Transparency = 1;
				v108.PrimaryPart.Color = v1.RangeColor;
				if v108:FindFirstChild("Selection") ~= nil then
					v108.Selection.Visible = false;
				end;
			end;
		end);	
	end;
end;
function lerp(p17, p18, p19)
	return p17 + (p18 - p17) * p19;
end;
script.Parent.Parent.Parent.Placing.Changed:Connect(function()
	if script.Parent.Parent.Parent.Placing.Value ~= "" then
		script.Parent.Parent.Parent.CurrentSelection.Value = nil;
		placing(script.Parent.Parent.Parent.Placing.Value);
	end;
end);
function gettouching(p20)
	local v109 = p20:GetTouchingParts();
	p20.Touched:Connect(function()

	end):Disconnect();
	return v109;
end;
game:GetService("RunService").RenderStepped:Connect(function(p21)
	if u2 ~= nil then
		local v110, v111, v112, v113 = mousepos({ workspace.Game.Enemies, workspace.Game.Towers, workspace.Game.Projectiles, workspace.Game.Players, workspace.Game.Map.Paths, workspace.Game.Units });
		v26.Target = v111;
		u3 = lerp(u3, u1, 0.5);
		u2.Hitbox.CFrame = CFrame.new(v26.Position) * CFrame.new(0, u2.Hitbox.Size.Y / 2, 0) * CFrame.Angles(2 * 0.005, 0, 2 * 0.005) * CFrame.Angles(0, math.rad(u3), 0);
		u2.Range.CFrame = CFrame.new(v26.Position) * CFrame.Angles(math.rad(90), 0, 0);
		if u2:FindFirstChild("AbilityName") == nil then
			u2.Hitbox.CFrame = CFrame.new(v26.Position) * CFrame.new(0, u2.Hitbox.Size.Y / 2, 0) * CFrame.Angles(2 * 0.005, 0, 2 * 0.005) * CFrame.Angles(0, math.rad(u3), 0);
			u2.Range.CFrame = CFrame.new(v26.Position) * CFrame.Angles(math.rad(90), 0, 0);
		else
			u2.Hitbox.CFrame = CFrame.new(v26.Position) * CFrame.new(0, u2.Hitbox.Size.Y / 2, 0);
			u2.Range.CFrame = CFrame.new(v26.Position) * CFrame.Angles(math.rad(90), math.rad(90), 0);
end;
--CFrame.Angles(v26.Velocity.Z
		local v114 = true;
		local v115 = false;
		if workspace.Game.SurvivalMode.Value == false then
			if game.Players.LocalPlayer.Team.Name == "Red" then
				if v110 ~= nil and v110:IsDescendantOf(workspace.Game.Map2) then
					v114 = false;
				end;
			elseif game.Players.LocalPlayer.Team.Name == "Blue" and v110 ~= nil and v110:IsDescendantOf(workspace.Game.Map) then
				v114 = false;
			end;
		end;
		if u2:FindFirstChild("RealHitbox") ~= nil then
			u2.RealHitbox.CFrame = CFrame.new(v26.Position) * CFrame.new(0, u2.Hitbox.Size.Y / 2, 0);
			for v116, v117 in pairs((gettouching(u2.RealHitbox))) do
				if v117.Name ~= "Baseplate" and v117.Name ~= "InfiniteBaseplate" and v117.Parent ~= workspace.Game.Map then
					if v117:IsDescendantOf(workspace.Game.Map.Unplaceable) then
						v115 = true;
					elseif v117:IsDescendantOf(workspace.Game.Towers) and v117.Name == "Hitbox" and v117.Parent.Name == "Server" then
						v115 = true;
					end;
				end;
			end;
			if v113 == Enum.Material.Water then
				v115 = true;
			end;
			if v110 == nil or v115 == true or not (not v110:IsDescendantOf(workspace.Game.Map.Unplaceable)) or v114 == false then
				u2.PrimaryPart.Color = v1.IncorrectColor;
				u2.PrimaryPart.Selection.Color3 = v1.IncorrectColor;
				u2.Range.Color = v1.IncorrectColor;
				u2.Range.Transparency = 0.8;
				return;
			else
				u2.PrimaryPart.Color = v1.RangeColor;
				u2.PrimaryPart.Selection.Color3 = v1.RangeColor;
				u2.Range.Color = v1.RangeColor;
				u2.Range.Transparency = 0.9;
			end;
		end;
	end;
end);
game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(p22)
	if p22 == "z" then
		doneplacing(false);
		script.Parent.Parent.Parent.Placing.Value = "";
		return;
	end;
	if p22 == "r" and script.Parent.Parent.Parent.Placing.Value ~= "" then
		u1 = u1 + 45;
		script.ChangeRotation:Play();
		return;
	end;
	if p22 == "q" and script.Parent.Parent.Parent.Placing.Value ~= "" then
		u1 = u1 - 45;
		script.ChangeRotation:Play();
	end;
end);
while true do
	wait();
	if workspace.Game:FindFirstChild("Map") ~= nil and workspace.Game.Map:FindFirstChild("Paths") ~= nil then
		break;
	end;
end;
local v118 = tick();
script.Parent.Parent.Parent.Trash.Trash.MouseButton1Click:Connect(function()
	if u2 ~= nil then
		doneplacing(false);
	end;
end);
local u4 = v118;
game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function()
	local v119 = nil;
	if v2 == true and tick() - u4 > 0.3 then
		u4 = tick();
		return;
	end;
	if u2 ~= nil then
---Line 812
		doneplacing(true);
		return;
	end;
	if u2 == nil then
		local v120 = nil;
		v119, v120 = mousepos({ workspace.Game.Enemies, workspace.Game.Projectiles, workspace.Game.Players, workspace.Game.Map.Paths, workspace.Game.Units });
		if v119 == nil or not v119:IsDescendantOf(workspace.Game.Towers) then
			script.Parent.Parent.Parent.CurrentSelection.Value = nil;
			return;
		end;
	else
		return;
	end;
	local v121 = nil;
	if v119.Parent.Parent.Name == "Towers" then
		v121 = v119.Parent.Configuration;
	elseif v119.Parent.Parent.Parent.Name == "Towers" then
		v121 = v119.Parent.Parent.Configuration;
	elseif v119.Parent.Parent.Parent.Parent.Name == "Towers" then
		v121 = v119.Parent.Parent.Parent.Configuration;
	elseif v119.Parent.Parent.Parent.Parent.Parent.Name == "Towers" then
		v121 = v119.Parent.Parent.Parent.Parent.Configuration;
	elseif v119.Parent.Parent.Parent.Parent.Parent.Parent.Name == "Towers" then
		v121 = v119.Parent.Parent.Parent.Parent.Parent.Configuration;
	end;
	if v121 ~= nil and v121.Owner.Value == game.Players.LocalPlayer then
		script.Parent.Parent.Parent.CurrentSelection.Value = v121.Parent;
		return;
	end;
	script.Parent.Parent.Parent.CurrentSelection.Value = nil;
end);
game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(p23)
	if p23 == "1" or p23 == "2" or p23 == "3" or p23 == "4" or p23 == "5" then
		local v122 = game.Players.LocalPlayer.TowersChosen["Slot" .. p23].Value;
		if workspace.Game.GameStats.ChallengeOptions.ForcedTower:GetAttribute("Slot" .. p23) ~= nil then
			v122 = workspace.Game.GameStats.ChallengeOptions.ForcedTower:GetAttribute("Slot" .. p23);
		end;
		if v122 ~= "" and v122 ~= "Locked" then
			script.Parent.Parent.Parent.Placing.Value = v122;
		end;
	end;
end);

Hello!
In your script, you define place as:

local place = game.player.PlayerGui.ScreenGui.Placing.Value

However, player is an argument from the client passed through InvokeServer. It cannot be indexed under game, because the script is now trying to find an instance called player inside of game, which most likely won’t exist. To fix this, just change it’s definition to:

local place = player.PlayerGui.ScreenGui.Placing.Value

Another issue I caught:

local mouse = player:GetMouse()

This will definitely error because you are trying to get the mouse on the server. The mouse is a client-sided instance only. It can not be accessed from the server. You must pass it from the client to the server.

As for it printing nil for u2 (line 668), you set u2 to nil a couple lines previous, so of course it’ll be nil!

Lines 662-663:

u2:Destroy();
u2 = nil;

Line 668:

print("Type of u2.Name is:", type(u2.Name))

I’m really not sure how to help you here. (I really don’t understand what the hell the code is trying to do. :confused: )

Also, your buddy stole that script, just saying.

That code lines up perfectly with the infamous exploit Synapse X’s LuaU decompiler; at least as far as I can tell, judging from previous samples from around devforum and the web.

So, although I could invest my time to help, I’m not going to; simply because this is a stolen asset.

so your tellling me this game ive spent 200 hours on has stolen scripts how do i know if they are stolen or not

put the print at the end of the local script and got

let me use a part of your code as example

function mousepos(p1) -- Parameters are defined weird, and they increment globally, not per function.
    local l__mouse__4 = game.Players.LocalPlayer:GetMouse(); -- variable names are formatted in between "l__%s__%d" where %s is the variable name, and %d is again a global iterator for variables.
    -- I think these are just generic variables, since there's no naming scheme other than "v%d"
    local v5, v6, v7, v8 = workspace:FindPartOnRayWithIgnoreList(Ray.new(
                                                                     l__mouse__4.UnitRay
                                                                         .Origin,
                                                                     l__mouse__4.UnitRay
                                                                         .Direction *
                                                                         900),
                                                                 p1);
    return v5, v6, v7, v8;
end

And to add on, the next function that’s defined:

function tween(p2, p3, p4, p5, p6, p7) -- we see here how the parameters increment globally.
    -- same thing with these
    -- also, notice how references to stuff like TweenService isn't strictly defined?
    -- I've seen some cases where they are defined but I do not know how old this project is
    -- and I've only seen cases where they're defined in some recent snippets.
    local v9 = game:GetService("TweenService"):Create(p2, TweenInfo.new(p4, p5,
                                                                        p6, 0,
                                                                        p7, 0),
                                                      p3);
    v9:Play();
    return v9;
end

I hope this helps you with sorting out your codebase.


print(string.format("Cheers,\n\t%s\t[%s]", "IDoLua", "CantBeBothered"))
>>Cheers,
>>  IDoLua  [CantBeBothered]