Hello, why is my CFrame
script not working as I thought it should I hope someone Can help me?
game.Workspace.Kook.CFrame = game.Workspace.Kookin.CFrame.lerp(game.Workspace.Kookina.CFrame, 0.4)
If you want your Kook
part to gradually move toward Kookin
, then try the code below
local Kook = workspace.Kook -- Define Kook, I usually like defining variables local Kookin = workspace.Kookin -- Instead of game.Workspace, I prefer workspace local StartCFrame = Kook.CFrame -- This only works if Kook is a Part local EndCFrame = Kookin.CFrame local Step = 0.01 -- Default local Time = 1 -- 1 Second for Time = 0, 1, Step do -- Loop variable "Time" from 0 to 1 with step 0.01 Kook.CFrame = StartCFrame:Lerp(EndCFrame, Time) -- Lerp function wait(Step*Time) end
You can change Step
to be anything, as long as it is
Under 1
Over 0
1÷Step is a whole number