Can anyone explain why this is happening? Randomly, other players characters will displace themselves, and also rotate when someone’s camera is panned around.
I have lobby queues that teleport player characters into the lobby and a store that changes your camera view to focus on the lobby. Could those two cause this?
This is the code for the camera change. Camerapart and endcampart are the points
the camera goes to during the shop animation.
workspace.ShopPrompt.ProximityPrompt.Triggered:Connect(function(player)
if gui.Info.StoreFrame.Visible == false then
local camera = workspace.CurrentCamera
local campart = workspace.CameraPart
camera.CameraType = "Scriptable"
camera:Interpolate(workspace.EndCamPart.CFrame, campart.CFrame, 0.5)
gui.Info.StoreFrame.Visible = true
end
end)
gui.Info.StoreFrame.ExitButton.Activated:Connect(function()
if gui.Info.StoreFrame.Visible == true then
local camera = workspace.CurrentCamera
gui.Info.StoreFrame.Visible = false
local player = Players.LocalPlayer
camera.CameraSubject = player.Character.Humanoid
camera.CameraType = "Custom"
camera.CFrame = Player.Character.Head.CFrame
end
end)
And this is the player movement part of the teleportation script. The camera and the lobby teleport aren’t linked, obviously.
script.Parent.Gate.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local char = hit.Parent
local player = game.Players:FindFirstChild(char.Name)
game.ReplicatedStorage.Events.SlotEmptyEvent:FireClient(player)
if teleporting == false and not hit.Parent.InLobby.Value then
local char = hit.Parent
local player = game.Players:FindFirstChild(char.Name)
local alreadyExists = false
for i=1,#list do
if list[i] == char.Name then
alreadyExists = true
end
end
if alreadyExists == false then
if #list < 6 then
local guiframe = script.Parent.billboardPart.billboardGui
local leaveguinum = 1
table.insert(list,char.Name)
char.PrimaryPart.CFrame = spawnTeleport.CFrame
updateGui()
player.Character.InLobby.Value = true
leaveGuiEvent:FireClient(player, leaveguinum)
end
player.CharacterRemoving:connect(function(character)
removeFromList(character)
end)
end
end
end
end)
Codes are a bit messy, but I’m mostly just trying to show the parts that could be causing the bug. My guess is the camera script, because I don’t know the proper way of setting the camera back to normal after changing it.
Assuming this is a LocalScript, my thinking is that perhaps if a player is zoomed in or using MouseLock, changing their camera will also change the position of their character. I’m not entirely sure though as I haven’t dealt with an interaction like that before.
Perhaps if you set Player.CameraMinZoomDistance before changing the camera you could get past this issue. You might also need to change the CameraSubject to nil so that it’s still not the character’s humanoid.
I’ll try this out, I’ll set the minzoomdistance to a bigger number so players aren’t allowed to zoom in all the way during the shop animation. I’ll also set the camerasubject to nil. I’ll update this post when I do testing with other players in the future to see if the bug persists.
Welp, did some testing again and turns out this glitch is still happening. I now know for sure its something with the teleport script. Is there some kind of glitch where a script moving a player is fired multiple times really fast that makes the character displaced for other people? The player is moved on the server, not on the client.
Basically someone entering and then exiting the queue really fast makes it so the character gets displaced for other people. Is there a better way to teleport someone?