- What do you want to achieve? Keep it simple and clear!
Basically. Im making a system where you need to place cardboard boxes to reach the next stage in my obby. Though i noticed that the boxes positions replicate back to the server when i drop them.
As you can guess. This is obviously game breaking. This is meant to only replicate to the local player thats placing the boxes and not to everyone in the server.
I currently have no idea if theres a way to disable weld constraints(Used for attaching the box to the player) from replicating to everyone.
Ive done some research but sadly i only found topic along the lines of “How to make this thing replicate to the server” or “Thing not replicating correctly to server” which doesnt help me the slightest.
I currently have the locla script that handles the inputs inside “StarterPlayerScripts”.
Heres the code also:
local function WeldToCharacter(Box: Model)
local Root = game.Players.LocalPlayer.Character.UpperTorso
local Weld = Instance.new("WeldConstraint")
Box:PivotTo(Root.CFrame * CFrame.new(0,0,-2))
Weld.Part0 = Box.PrimaryPart
Weld.Part1 = Root
Weld.Parent = Box.PrimaryPart
Weld.Name = "Grip"
end
local function HandleCollision(Collision: boolean)
for _, P in CurrentBox:GetChildren() do
P.CanCollide = Collision
end
end
local function OnDrop()
HasBox = false
Hold:Stop()
SoundHandler:Play("Cardboard drop")
local Weld = CurrentBox.PrimaryPart.Grip
HandleCollision(true)
Weld.Part1 = nil
Weld:Destroy()
Drop:Disconnect()
Drop = nil
CurrentBox.PrimaryPart.Prompt.Enabled = true
CurrentBox = nil
end
local function EquipBox(Box: Model)
Hold:Play()
HasBox = true
CurrentBox = Box
CurrentBox.PrimaryPart.Prompt.Enabled = false
WeldToCharacter(Box)
HandleCollision(false)
Drop = Plr:GetMouse().Button1Down:Connect(OnDrop)
end
Primary.Prompt.Triggered:Connect(function()
if not HasBox then
EquipBox(Box)
else
OnDrop()
EquipBox(Box)
end
end)