Unable to cast Instance to CoordinateFrame

im not exactly sure what i am supposed to do to fix this
ive tried looking for solutions such as other people with the same problem
im not the best scripter but i was able to use a tutorial to learn lerpto()

does anyone know what ive done wrong?

4 Likes

can you show more of the script?

1 Like


ofc

to fix the error you just have to change waypoints[i] to waypoints[i].CFrame, however I dont think it will be the result you’re trying to achieve, so can you give more context on what ur tryig to do?

basically to put things simply when you touch a part in the workspace it spawns in a bigger part that then will go to all the waypoints (your supposed to avoid it while its doing this) then it’ll just leave
ill try your idea tho

the problem was it went to the first one then got stuck in the floor and ended up flying away ???

really its ambush from doors that just does what i said before

change the part of the script to this

local waypoints = game.Workspace:WaitForChild("EntityPoints"):GetChildren()
local currentWaypoint = 1

lerp = RunService.RenderStepped:Connect(function(deltaTime)
 runningTime += deltaTime
 alpha = deltaTime / lerpTime
 part.CFrame = part.CFrame:Lerp(waypoints[currentWaypoint].CFrame, alpha)
 if (part.CFrame.Position-waypoints[currentWaypoint].CFrame.Position) <= 0.5 then
  part.CFrame = waypoints[currentWaypoint].CFrame
  currentWaypoint += 1
 end
end)

if the part doesnt go to the waypoints in the correct order tell me

it says RenderStepped event can only be used from local scripts
ill change it to local since theres only ever one player in the game at a time

problem is now he just sits there not moving
no errors

might be helpful to know that the part is also in a model
image

local script cant run when parented to parts, change it to a normal script and make the runcontext client.

also I made a mistake in the script I gave you

replace the line similair to this

if (part.CFrame.Position-waypoints[currentWaypoint].CFrame.Position).Magnitude <= 0.5 then

you mean
local RunService = game:GetService(“RunService”)
at line 1? im not sure what runcontext is

runcontext is a property of a script. its like changing transparency or color

i dont see runcontext in the script anyway

i think ive done the script wrong and not put what you wanted me in the right place

yeah just delete the other lerp heartbeat loop and only keep the one I sent, also you can change it to heartbeat I dont think its gonna matter anyways

hm well renderstepped can only be called from a local

you can use heartbeat and change it back to a server script, if you want it to run on the client just change the runcontext that is under enabled in the script properties