I'm making a game where players can switch between alternate realities by pressing E, and this is done locally. Two different folders exist but only one is on the client at a time. I wanted a ghost that only one player could see on their client, and one that conforms to what is currently on their client in terms of obstacles. I have a working ghost but it only starts working once you get within about 5 studs of it.
There are messaged parts of code that outline the distance, those will be added later. For now, I want to make sure I can get it to always work.
local player = game.Players.LocalPlayer
player.CharacterAdded:Connect(function()
local plr = player.Character
local guest = game.Workspace:FindFirstChild("Guest 1")
--local dist = 1000
local pos = guest.Torso.Position
--wait(math.random(0,5)/10)
while true do
wait(0.01)
if guest.Torso ~= nil then
local target = plr.Torso
if target ~= nil then
--if (target.Position - pos).magnitude < dist then
if plr.Humanoid.Health ~= 0 then
--guest.N00BHumanoid:MoveTo(target.Position, target)
guest.N00BHumanoid.WalkToPoint = target.Position
end
--end
end
end
end
end)
