Can you script it? I have only ever used raycasting to kill players.
I know how to make them jump, I only need the raycasting, as I am a newbie with it.
I mean yeah but don’t use it cuz I’m only providing an example
Oh and we also have to get the look direction of the random position it’s moving to so we have to store our Vector in a variable (and make it a CFrame so we can access the LookVector)
local Pos = CFrame.new(math.random(-50, 50), 0, math.random(-50, 50))
--[[ code formatting
on mobile is hard so just
pretend your code is above ]]
if DelayT == false then
-- should be the right calculation
local Cast = workspace:Raycast(script.Parent.Position, Pos.LookVector * 50)
local DistanceTilJump
if Cast then
DistanceTilJump = math.abs(script.Parent.Position - Cast.Position)
end
local Origin = script.Parent.Position
coroutine.wrap(function()
while task.wait(0.5) do
if (script.Parent.Position - Origin).Magnitude == DistanceTilJump then
script.Parent.Parent.Humanoid:SetState(Enum.HumanoidStateType.Jumping)
end
end
end)()
script.Parent:MoveTo(script.Parent.Parent:WaitForChild('HumanoidRootPart').Position + Pos.Position)
end
while task.wait(0.5) do
if (script.Parent.Position - Origin).Magnitude == DistanceTilJump then
script.Parent.Parent.Humanoid:SetState(Enum.HumanoidStateType.Jumping)
end
I don’t think this is good but I haven’t really dealt with something like this before. Maybe someone else has a better method?
Overall I’d recommend pathfinding but it’s your game