I've been working on this script for like a couple days until I got stuck on something I've been trying to fix it for 2 months and I haven't got a single clue what is causing the problem. I've even gotten some experienced scripters to help me with it but all 3 of them couldn't get it working

When I try this it works first try no problems but when I do it again nothing happens

(Not the full script but it's the main part that is breaking)

local function Shift(Bool)
	if Bool == true and IsShifting == false then
		IsShifting = true
		game.Lighting.GlobalShadows = false
		for _, child in pairs(Char:GetDescendants()) do
			if child:IsA("Part") then
				child.CustomPhysicalProperties = PhysicalProperties.new(0.05,0.3,0.5)
			end
		end
		Plr:GetMouse().Icon = "rbxasset://textures/Blank.png"
		game.Lighting.ShiftBlur.Enabled = true
		game.Lighting.ShiftDepthOfField.Enabled = true
		game.Lighting.ShiftColorCorrection.Enabled = true
		game.ReplicatedStorage.ServerShift:FireServer("EnterShift")
		workspace.Gravity = 1000
		workspace.CurrentCamera.FieldOfView = 57.5
		local ShiftPlate = Instance.new("Part")
		ShiftPlate.Name = "ShiftPlate"
		ShiftPlate.Anchored = true
		ShiftPlate.Transparency = 1
		ShiftPlate.Size = Vector3.new(2048,2048,2048)
		ShiftPlate.Parent = workspace
		local AllSeeingEye = script.AllSeeingEye:Clone()
		AllSeeingEye.Parent = workspace
		local Weld = Instance.new("Weld")
		Weld.Parent = AllSeeingEye
		Weld.Part0 = AllSeeingEye
		Weld.Part1 = Char:FindFirstChild("HumanoidRootPart")
		Weld.C0 = CFrame.new(0,32.5,-15)
		script.Parent.AllSeeingEye.Visible = true
		script.Parent.AllSeeingEyeCursor.Visible = true
		Char:FindFirstChildOfClass("Humanoid").Changed:Connect(function()
			if Char:FindFirstChildOfClass("Humanoid").Sit == true or Char:FindFirstChildOfClass("Humanoid").Jump == true then
				Char:FindFirstChildOfClass("Humanoid").Sit = false
				Char:FindFirstChildOfClass("Humanoid").Jump = false
			end
		end)
		game:GetService("RunService").RenderStepped:Connect(function()
			if IsShifting == false then return end
			workspace.CurrentCamera.CameraType = "Scriptable"
			workspace.CurrentCamera.CFrame = AllSeeingEye.CFrame
			Weld.C0 = CFrame.new(0,32.5,-15)
			AllSeeingEye.Orientation = Vector3.new(-25,AllSeeingEye.Orientation.Y,AllSeeingEye.Orientation.Z)
			ShiftPlate.CFrame = CFrame.new(Char.HumanoidRootPart.CFrame.X,workspace.FallenPartsDestroyHeight-1024,Char.HumanoidRootPart.CFrame.Z)
			game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter
			for i,v in pairs(game.Players:GetPlayers()) do
				local ray = Ray.new(Plr:GetMouse().Hit.Position, v.Character.HumanoidRootPart.Position - Plr:GetMouse().Hit.Position)
				local part,position = game.Workspace:FindPartOnRayWithWhitelist(ray, {v.Character.HumanoidRootPart})
				local magnitude = (Plr:GetMouse().Hit.Position - position).Magnitude
				if magnitude < 15 and game.Players:FindFirstChild(v.Name) and game.Players:FindFirstChild(v.Name).Character and game.Players:FindFirstChild(v.Name).UserId ~= 90841678 and not game.Players:FindFirstChild(v.Name):FindFirstChild("IsShifter") then
					for _, child in pairs(v.Character:GetDescendants()) do
						if child:IsA("Part") then
							script.Parent.Info.Visible = true
							script.Parent.Info.PlrName.TextBox.Text = "Name: "..game.Players[v.Name].Name
							script.Parent.Info.PlrSpeed.TextBox.Text = "Speed: "..game.Players[v.Name].Character:FindFirstChildOfClass("Humanoid").WalkSpeed
							script.Parent.Info.PlrJump.TextBox.Text = "Jump Power: "..game.Players[v.Name].Character:FindFirstChildOfClass("Humanoid").JumpPower
							if game.Players[v.Name].Character:FindFirstChildOfClass("Humanoid").Health < math.huge then
								script.Parent.Info.PlrHealth.TextBox.Text = "Health: "..game.Players[v.Name].Character:FindFirstChildOfClass("Humanoid").Health
							else
								script.Parent.Info.PlrHealth.TextBox.Text = "Health: ?"
							end
							game.Players[v.Name].Character.Archivable = true
							if not script.Parent.Info.ViewportFrame:FindFirstChild(game.Players[v.Name].Character.Name) then
								local PlrClone = game.Players[v.Name].Character:Clone()
								PlrClone.HumanoidRootPart.Anchored = true
								PlrClone.Parent = script.Parent.Info.ViewportFrame
								PlrClone:SetPrimaryPartCFrame(CFrame.new(0,100000.5,0))
							end
							child.Material = Enum.Material.ForceField
							IsHoveringOverPlr = true
							PlrName = v.Name
							game.Players[PlrName].Character.Archivable = false
							if not game.Players[PlrName].Character.HumanoidRootPart:FindFirstChildOfClass("PointLight") then
								local PointLight = Instance.new("PointLight")
								PointLight.Name = "ShiftLight"
								PointLight.Brightness = 2.125
								PointLight.Range = 8
								PointLight.Parent = game.Players[PlrName].Character.HumanoidRootPart
							end
						end
					end
				else
					IsHoveringOverPlr = false
					PlrName = nil
					script.Parent.Info.Visible = false
					script.Parent.Info.PlrName.TextBox.Text = "Name:"
					script.Parent.Info.PlrSpeed.TextBox.Text = "Speed:"
					script.Parent.Info.PlrJump.TextBox.Text = "Jump Power:"
					script.Parent.Info.PlrHealth.TextBox.Text = "Health:"
					if script.Parent.Info.ViewportFrame:FindFirstChildOfClass("Model") then
						script.Parent.Info.ViewportFrame:FindFirstChildOfClass("Model"):Destroy()
					end
					PlasticAll()
					end
				end
		end)
		Flash()
	else
		IsShifting = false
		workspace:FindFirstChild("ShiftPlate"):Destroy()
		game.Lighting.GlobalShadows = true
		game.Lighting.ShiftBlur.Enabled = false
		game.Lighting.ShiftDepthOfField.Enabled = false
		game.Lighting.ShiftColorCorrection.Enabled = false
		workspace.Gravity = Gravity
		workspace.CurrentCamera.CameraType = "Custom"
		workspace.CurrentCamera.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
		workspace.CurrentCamera.FieldOfView = 70
		AllSeeingEyeCursor.Visible = false
		AllSeeingEye1.Visible = false
		script.Parent.Info.Visible = false
		IsHoveringOverPlr = false
		PlrName = nil
		script.Parent.Info.Visible = false
		script.Parent.Info.PlrName.TextBox.Text = "Name:"
		script.Parent.Info.PlrSpeed.TextBox.Text = "Speed:"
		script.Parent.Info.PlrJump.TextBox.Text = "Jump Power:"
		script.Parent.Info.PlrHealth.TextBox.Text = "Health:"
		if script.Parent.Info.ViewportFrame:FindFirstChildOfClass("Model") then
			script.Parent.Info.ViewportFrame:FindFirstChildOfClass("Model"):Destroy()
		end
		PlasticAll()
	end
end

8 comments

0

Is there any errors? Where exactly does it break, you can use print to find it if there is no errors.

0

There are no errors and I also used prints an d found nothing

0

They probably found nothing because of this beautiful code

0
  1. Don't reply if what your gonna say won't help the issue 2. I like to quickly do the code and once I've finished I ""beautify"" it.
0

Sorry, the point was "Can you shorten it???"

0

It is much longer this is only the main part of it

0

Which part does it Crash?

0

a friend fixed it for me don't worry about it now