Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I remove this error, and what does said error even mean?

The code:

Player = game.Players.LocalPlayer
Torsoz = Player.Character:WaitForChild("Torso")
Mouse = Player:GetMouse()
TeleportCooldown = 1
Mouse.KeyDown:connect(function(key)
	if key == "e" then
		if game.Players.LocalPlayer.leaderstats.Level.Value >= 10 then
			if TeleportCooldown == 1 then
				FireStuffz = Instance.new("ParticleEmitter", game.Players.LocalPlayer.Character.Torso)
				FireStuffz.Name = "FireStuffz"
				FireStuffz.Color = ColorSequence.new(Color3.fromRGB(255, 70, 14))
				FireStuffz.Lifetime = NumberRange.new(0.1, 0.5)
				FireStuffz.Size = NumberSequence.new(20)
				FireStuffz.LockedToPart = true
				TeleportCooldown = 0
				wait(5)
				dist = (Torsoz.Position - Mouse.Hit.P).magnitude
				if dist <= 10000 then
					Torsoz.CFrame = CFrame.new(Mouse.Hit.P) + Vector3.new(0, 3, 0)
				end
				wait(60)
				TeleportCooldown = 1
			end
		end
	end
end
)

Error: P is not a valid member of CFrame

1 answer

✓ Accepted answer

It should be "Mouse.Hit.p" with a lowercase "p" because you are grabbing the position of the mouse's CFrame. Technically you won't need CFrame.new(Mouse.Hit.p) since the Mouse.Hit itself should be a CFrame value.

This discussion is preserved as it was. New answers, comments, and votes are closed.