So recently ive found out about :lerp() and ive tried to make throwing knives, now this is just a test script but the knives instantly arrive at the mouse
01 | local event = game.ReplicatedStorage.Firetest |
02 | event.OnServerEvent:Connect( function (plr,mouse,mousehit) |
03 | local part = Instance.new( "Part" ,workspace) |
04 | part.Size = Vector 3. new( 1 , 1 , 1 ) |
05 | part.Material = Enum.Material.Foil |
06 | part.CanCollide = true |
07 | part.Anchored = false |
08 |
09 |
10 | for i = 0 , 1 , 0.001 do |
11 | wait() |
12 | part.CFrame = mousehit:lerp(mousehit, 3 ) |
13 | end |
14 | end ) |
Im also using remotes this is the server scrips, the localscript just activates when a tool is activated.
Is there a way to slow down lerp? Thanks for help :)
alright, uhh, don't use lerp use tweenservice?
01 | local event = game.ReplicatedStorage.Firetest |
02 | event.OnServerEvent:Connect( function (plr,mouse,mousehit) |
03 | local part = Instance.new( "Part" ,workspace) |
04 | part.Size = Vector 3. new( 1 , 1 , 1 ) |
05 | part.Material = Enum.Material.Foil |
06 | part.CanCollide = true |
07 | part.Anchored = false |
08 | game:GetService( 'TweenService' ):Create(part, TweenInfo.new( 1 ), { Position = mousehit.Position } ):Play() |
09 |
10 | end ) |