I’ve been working on my game for almost 2 years now, and since the beginning, i’ve started to see an issue encounter more frequently as time passes.
According to the roblox client, the player model is somewhere else than where they are actually meant to be. This makes it very hard for game moderators to know if the player is either bugging out, or actually exploiting. This is happening to their clients as well, after all.
https://i.imgur.com/IJ2P3Om.png
to track this, I’ve used adonis, which marks the player’s model, and its actual location
https://i.imgur.com/G0W7hBL.png
I’ve tried solving this using a RemoteFunction that returns the CFrame of the player according to the server, and putting the player position there with the client. It hasn’t appeared to be successful, though.
localscript:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteFunction = ReplicatedStorage.GetPlayerPosition
Players.PlayerAdded:Once(function(plr)
plr.CharacterAdded:Once(function()
for _,v in Players:GetPlayers() do
local plrName = v.Name
if v.Name ~= Players.LocalPlayer.Name then
local ReceivedCFrame = RemoteFunction:InvokeServer()
v.Character:SetPrimaryPartCFrame(ReceivedCFrame)
end
end
end)
end)
serverscript:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local function GetPlayerPos(plr,requiredPlayer)
local Player:Player = Players:FindFirstChild(requiredPlayer)
local PlayerPos = Player.Character.PrimaryPart.CFrame
return PlayerPos
end
ReplicatedStorage.GetPlayerPosition.OnServerInvoke = GetPlayerPos
I have no idea what’s causing this issue in the first place, nor a proper solution for it. I haven’t found a post with the same issue on the devforum, so help would be greatly appreciated.
1 Like
Hey there,
In the first photo it looks like the player is holding a tool of some kind (a lantern maybe?). Is this a common occurrence when players are “frozen” in place? If so, it would be worthwhile to make sure you aren’t changing something one-sided with that tool (the anchorage). Otherwise, you should check to make sure you aren’t trying to have the server handle any player movement. This should be done on the client. Also it isn’t worth sending an event to check the locations like this, there is always going to be slight delays with the server & clients.
Some more information about the circumstances when players first get stuck on the server but continue to move on their client would be helpful to uncover the root issue here. (Is it happening in the same place, with the same or any tools, different people, etc.) As much information as you’re able to provide will make it easier to figure this out.
A couple of things.
:SetPrimaryPartCFrame() is deprecated, and when using it, issues of how accurate it is, may come up from it not being supported. Instead you should be using PivotTo() as Roblox is supporting and you should still get the same results you would get with :SetPrimaryPartCFrame().
Also Possibly consider changing the characters position on the server instead of the client. I have gotten weird results when trying to change a characters position on the client, but we’re fixed when I used the server. Just a thought though.
Apologies for the late response, I just came back from my holiday.
In the first screenshot the player is holding a soul, or in this case just a simple light source.
the tool doesn’t have a script either that would change anything position-related on one side.
As for the “movement” you mentioned: The player isn’t stuck. they can still freely move around to their wish, but the model of the player itself “spasms” out based on how far off the model is from its actual position on the client.
This has been happening with all 3 experiences I use for developing, all with the same issues, regardless of what tool they’re holding. It also seems to be variating between players. Sometimes it does work, sometimes it doesn’t.
The only real way I knew how to sort of fix the issue ingame was using the refresh command with the admin system, or just any way of having them reload their character in some sort, but it’s rather annoying having to do that over and over, and I’m pretty sure other players would be annoyed by it as well.
But if i change the position of the character through the server, wouldn’t that impact the others as well? I’d prefer having the character model of others be fixed on the player client without the others needing to notice.
What is the last thing the player does before this occurs, is it when they equip the tool? Like the location of them getting “stuck” is that the location of them equipping the tool? Are they always getting stuck in the same spot? If so, make sure the Handle isn’t anchored.
If you’re saying they aren’t freezing… but they are getting “stuck” in one position on the server right? So frozen on the server, still playing on the client?
As i said, they are not stuck. No handles are anchored or anything.
It doesn’t matter what the last thing is that the player does before it happens. the bug already starts the moment I join the game with other people.
As for attempting to elaborate on the so called freezing:
It is only the character model that is “getting stuck”, even though that’s not the right way to put it. The players that are affected by this bug can still move around like any normal player, along with being able to interact. Its only their character model that is off-set with their actual position on my client. When the player moves, their model moves with it accordingly, yet keeping the same CFrame offset.
Sorry if its hard to understand, by the way. I am not very good at explaining things in full detail.