Mantle Script not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to Make a mantle script for signs that are currently there and signs that will spawn in at a later time

  2. What is the issue? whenever i jump on it does latch me onto the sign

  3. What solutions have you tried so far? I have tried using while true loops but that teleports me back to the past sign and i have tried setting it to humanoid.touched and checked if it hit the part but it still doesnt latch on either

ClonedMaps.ChildAdded:Connect(function(Map)
	for _, Obstacle in pairs(Map.Obstacles:GetChildren()) do
		if Obstacle.Name == "Sign2" then
			Obstacle.HitDetect.Touched:Once(function(hit)

				Controls:Disable()

				Heartbeat:Wait()

				Character.PrimaryPart.AssemblyLinearVelocity = Vector3.new(0, 0, 0)

				local CancelGrav = Instance.new("BodyVelocity")
				CancelGrav.MaxForce = Vector3.new(0, 1, 0) * 30000
				CancelGrav.Velocity = Vector3.new(0, 0, 0)
				CancelGrav.Name = "CancelGrav"
				CancelGrav.Parent = HRP

				local Sign2Params = RaycastParams.new()
				Sign2Params.FilterType = Enum.RaycastFilterType.Exclude
				Sign2Params.FilterDescendantsInstances = {Character}

				local Sign2Ray = workspace:Raycast(Vector3.new(HRP.Position.X, 5.286, HRP.Position.Z), Vector3.new(-5, 0, 0), Sign2Params)

				if Sign2Ray ~= nil and Sign2Ray.Instance.Parent.Name == "Sign2" then
					local Sign2 = Sign2Ray.Instance.Parent

					Character:PivotTo(Sign2.HitDetect.CFrame * CFrame.Angles(0, math.rad(90), 0))

					for i, v in pairs(Character:GetChildren()) do
						if v:IsA("Part") then
							v.CanCollide = false
						end
					end		

					local Sign2Idle = AnimationTracks.Sign2.Sign2Idle
					local Sign2Jump = AnimationTracks.Sign2.Sign2Jump

					Sign2Idle:Play()
					
					print(Sign2Idle)
					
					Sign2Idle.Stopped:Connect(function()
						Sign2Jump:Play()
					end)

					Sign2Jump.Stopped:Connect(function()
						Character:PivotTo(CFrame.new(Sign2.MetalSign.Position + Vector3.new(-1.464, 1.899, 0.511)))
						Controls:Enable()
						CancelGrav:Destroy()

						delay(0.5, function()
							for i, v in pairs(Character:GetChildren()) do
								if v:IsA("Part") then
									v.CanCollide = true
								end
							end
						end)
					end)
				end
			end)
		end
	end
end)
2 Likes