Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[Solved] Looping player rotation glitches out, sorta spasms character? Any way to do it smoothly?

Edit: Ended up just using water lol.

SORRY IM ASKING TOO MANY QUESTIONS. But I have a little gravity test thing I'm working on and I want to rotate the player around slowly, but it glitches a lot. Do I need to add something or change anything? Here is my server script:

local TweenService = game:GetService("TweenService")
game.Players.PlayerAdded:Connect(function(p)
    local char = p.Character or p.CharacterAdded:Wait()
    local root = char.PrimaryPart
    while true do
        local tween = TweenService:Create(root,TweenInfo.new(5),{Rotation = Vector3.new(root.Rotation.X,root.Rotation.Y,root.Rotation.Z + 90)})
        tween:Play()
        tween.Completed:Wait()
    end
end)

And here is a video of what happens:

https://gyazo.com/0b587620317d176eea724a2bd3b36fa1

Micro profiler:

https://gyazo.com/5fd0acb7463b3194ba9a70508e806a04

Any other methods to use besides tweening? Thanks :)

Edit: Tried using a remote event but now it doesnt even move at all

Video: https://gyazo.com/fa7babf42b5e27deaf942e6e8b0db847

Server script:

local TweenService = game:GetService("TweenService")
game.Players.PlayerAdded:Connect(function(p)
    local char = p.Character or p.CharacterAdded:Wait()
    local root = char.PrimaryPart
    game.ReplicatedStorage.OSHSJS.OnServerEvent:Connect(function()
        root.Rotation = Vector3.new(root.Rotation.X,root.Rotation.Y,root.Rotation.Z + 0.001)
    end)
end)

Local script:

game["Run Service"].Heartbeat:Connect(function()
	script.Parent:FireServer()
end)

4 comments

0

Can you put a print so it's ensure running?

0

Also I gtg cya :)

0

I put prints and it is running, but it is not rotating

0

Oh nvm I don't need a solution anymore. Ended up using water from terrain

1 answer

✓ Accepted answer

Consider using remote event, it causes more less lag than tweens. Also if it doesn't work can you show your microprofiler because I wanna see if it's a lag issue?

5 comments

0

Also a note: Server-Side does not have enough performance to process large calculations in a short period while Client-Side does (Client-Side performance depends on your PC’s performance).

0

Also you can take a look of this: I took all the information from here. https://devforum.roblox.com/t/game-lagging-when-tween-plays/927783/39

0

Okay I added the microprofiler. When you say use a remote event, do you mean fire it every second and then add 90 to the Z axis using OnServerEvent?

0

Because TweenService fires it every 1/60 second. So it causes big lag

0

Okay I tried using a Remote Event but now it does not change the rotation at all, I edited my post

This discussion is preserved as it was. New answers, comments, and votes are closed.