-
What do you want to achieve?
I have a can-collide false part (I call it the collector) at the bottom of my feet. I want it to follow my character in real time with no delay. When I rotate my character I do not want the collector to rotate with me. I would like it to be on the server if possible, I don’t want the user to be able to tamper with the location of it. -
What is the issue?
The issue is that there is no server-side solution that locks the rotation of the collector without also locking the rotation of the character. It baffles me that roblox does not have any WeldConstraint equivalent that only locks the position of the other object, instead of both position and orentation. -
What solutions have you tried so far?
I have played around with: BodyGyro, AlignOrientation, AlignPosition, WeldConstraint, PrismaticConstraint, HingeConstraint. I have tried combining them in a script in a multitude of ways but it always ends up glitching out. For example, I tried combining AlignOrientation and AlignPosition but the collector ended up lagging behind a whole second. I have also tried continuously updating the position of the collector every frame withRunService:Heartbeat()
. The closest I got was a combination of WeldConstraint and Orientation updates:
-- Services
local Players : Players = game:GetService("Players")
local ServerStorage : ServerStorage = game:GetService("ServerStorage")
local RunService : RunService = game:GetService("RunService")
local models : Folder = ServerStorage:WaitForChild("Models")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local collector : BasePart = models:WaitForChild("Collector"):Clone()
collector.Parent = character
collector.CanCollide = false
collector.Massless = true
collector.Transparency = 1
local hrp : BasePart = character:WaitForChild("HumanoidRootPart")
collector.CFrame = hrp.CFrame * CFrame.new(0, -2.9, 0)
-- WeldConstraint for position locking
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Parent = collector
weldConstraint.Part0 = hrp
weldConstraint.Part1 = collector
-- Locks the rotation of the collector
RunService.Heartbeat:Connect(function()
collector.Orientation = Vector3.zero
end)
end)
end)
Here is how it looks:
I am considering just using this as the server-side object, with transparency set to 1. Then using a client-side collector for visual representation and actual collection, then doing sanity checks with the server side collector. I wan’t to avoid that if possible, so are there any solution I have overlooked? It’s almost how funny how hard I am finding this to be, just having a part follow me without it rotating.