You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Alright so im trying to make a carry system, it checks for a prop that has a Carryable tag and it will be carried via a spring so it can collide with other parts and such! -
What is the issue? Include screenshots / videos if possible!
Though i’ve been having a issue which may be network sided, the issue is when I drop a prop it just goes back to it’s original position from where i picked it up from. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried modifying the network ownership as i suppose that’d be related to the issue but im not sure
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
it doesn’t work in the roblox place itself or the roblox studio testing however when i check the server side it updates and actually works??? like wjhat???
here is the script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PickUpEvent = ReplicatedStorage:WaitForChild("Pickup")
local UpdateCarryPositionEvent = ReplicatedStorage:WaitForChild("UpdateCarryPosition")
local RunService = game:GetService("RunService")
local carryingData = {}
PickUpEvent.OnServerEvent:Connect(function(player, action, hitPart)
if action == "Carry" then
-- Set the network owner of the hit part to the player carrying it
hitPart:SetNetworkOwner(player)
-- Create the carry point in front of the camera direction
local carryPoint = Instance.new("Part")
carryPoint.Size = Vector3.new(1, 1, 1)
carryPoint.Transparency = 0.8
carryPoint.CanCollide = false
carryPoint.Anchored = true
carryPoint.Parent = workspace
local attachment1 = Instance.new("Attachment", carryPoint)
local attachment2 = Instance.new("Attachment", hitPart)
local spring = Instance.new("SpringConstraint")
spring.Visible = true
spring.Attachment0 = attachment1
spring.Attachment1 = attachment2
spring.LimitsEnabled = true
spring.MaxLength = 2
spring.Stiffness = 100
spring.Damping = 1
spring.MaxForce = 500
spring.Parent = carryPoint
-- Store carry data for cleanup on drop
carryingData[player.UserId] = {
CarryPoint = carryPoint,
Attachment1 = attachment1,
Attachment2 = attachment2,
Spring = spring,
CarriedPart = hitPart
}
elseif action == "Drop" and carryingData[player.UserId] then
-- Cleanup objects on drop
local carryInfo = carryingData[player.UserId]
carryInfo.CarryPoint:Destroy()
carryInfo.Attachment1:Destroy()
carryInfo.Attachment2:Destroy()
carryInfo.Spring:Destroy()
-- Remove carry data for this player
carryingData[player.UserId] = nil
hitPart:SetNetworkOwnershipAuto()
end
end)
-- Update carry position based on camera direction from client
UpdateCarryPositionEvent.OnServerEvent:Connect(function(player, cameraCFrame)
local carryInfo = carryingData[player.UserId]
if carryInfo then
-- Set carry point 5 studs in front of the camera
local carryPosition = cameraCFrame.Position + cameraCFrame.LookVector * 5
carryInfo.CarryPoint.Position = carryPosition
end
end)
and here is the local script if needed
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PickUpEvent = ReplicatedStorage.Pickup
local UpdateCarryPositionEvent = ReplicatedStorage.UpdateCarryPosition
local isCarrying = false
local carryingPart = nil -- To keep track of the currently carried part
-- Function to handle toggling
local function toggleCarry()
local target = mouse.Target
if carryingPart then
print("Stopping carry for part:", carryingPart.Name)
PickUpEvent:FireServer("Drop", carryingPart) -- Signal server to stop carrying
carryingPart = nil
isCarrying = false
elseif target and target:GetAttribute("Carryable") == true then
print("Starting to carry part:", target.Name)
carryingPart = target
PickUpEvent:FireServer("Carry", carryingPart) -- Signal server to start carrying
isCarrying = true
else
print("Target part is not carryable or no target selected.")
end
end
-- Detect "E" key press to toggle carrying
game:GetService("UserInputService").InputBegan:Connect(function(input, processed)
if input.KeyCode == Enum.KeyCode.E then
print("E key pressed.")
toggleCarry()
end
end)
game:GetService("RunService").RenderStepped:Connect(function()
if isCarrying then
local cameraCFrame = workspace.CurrentCamera.CFrame
UpdateCarryPositionEvent:FireServer(cameraCFrame)
end
end)