i’m testing something, i will be right back
Just in case you couldn’t figure out, the script is a local script in StarterPlayerScripts.
Well that’s weird, i’ve tried on my side and it’s working fine.
- First on the loop, on the spawned task, it get the player CFrame.
- I wait 1 second
- I print my position
And whenever i move, i clearly see a 1 second delay before the script catch up my position…
Try to copy and past the script back into it.
I copy and pasted it and it worked exactly how I wanted it. I don’t know what was the difference between my script and the copy and pasted one but thanks!
I did a modification right after i posted it, because of a typo, maybe you were too fast !
but if it work now, that’s what’s important, so your welcome !
I could be wrong but id like to say this may be a more optimized approach
My apologies I’m quite new to sending these so idk if I posted this correctly just hope it helps.
local clone = game.ReplicatedStorage.Rig:Clone()
clone.Parent = workspace
local Player = script.Parent.Parent
local Character = Player.Character or Player.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")
while true do
-- Capture the player's current position
local CRoot = Root.CFrame
-- Wait for the desired delay
task.wait(1)
-- Update the clone's position
clone.HumanoidRootPart.CFrame = CRoot
end
although i think this may be the best/better choice.
local clone = game.ReplicatedStorage.Rig:Clone()
clone.Parent = workspace
local Player = script.Parent.Parent
local Character = Player.Character or Player.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")
-- Position queue and delay settings
local positionQueue = {}
local delayTime = 0.5 -- Delay in seconds
-- Track player positions
task.spawn(function()
while true do
table.insert(positionQueue, Root.CFrame) -- Add the player's current position to the queue
task.wait(0.01) -- Frequency of tracking positions
end
end)
-- Update clone position with delay
task.spawn(function()
while true do
if #positionQueue > 0 then
clone.HumanoidRootPart.CFrame = table.remove(positionQueue, 1) -- Use the oldest position in the queue
end
task.wait(0.01) -- Match the tracking frequency or set independently
end
end)
My rational for chosing the second script, In theory
- Customizable Delay:
- You can adjust the
delayTime
variable to increase or decrease the lag effect. - No Loop Exhaustion:
- Since the two loops are independent, one tracks positions while the other applies them, preventing overlapping task executions.
- Smooth Movement:
- By tracking positions at regular intervals, the clone follows the player smoothly without skipping or jerking
i’ve imagined this at first,about making a table with all the CFrame data and a loop that will look through it, but in the end i wasn’t sure i could do it, so thanks for taking the time making this other solution
We never talked about SteamingEnabled… i’m not sure what you are trying to say…
That was the wrong post i thought i was replying to someone else so i deleted my message my apologies.
I am curious on how the solution i provided would’ve at least played out. XD