Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 3 years ago
Edited 3 years ago

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)
0
Can you put a print so it's ensure running? Xapelize 2658 — 3y
0
Also I gtg cya :) Xapelize 2658 — 3y
0
I put prints and it is running, but it is not rotating Omq_ItzJasmin 666 — 3y
0
Oh nvm I don't need a solution anymore. Ended up using water from terrain Omq_ItzJasmin 666 — 3y

1 answer

Log in to vote
1
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago

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?

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). Xapelize 2658 — 3y
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 Xapelize 2658 — 3y
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? Omq_ItzJasmin 666 — 3y
0
Because TweenService fires it every 1/60 second. So it causes big lag Xapelize 2658 — 3y
0
Okay I tried using a Remote Event but now it does not change the rotation at all, I edited my post Omq_ItzJasmin 666 — 3y
Ad

Answer this question