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!
A grab system similar to “The Long Drive”
- What is the issue? Include screenshots / videos if possible!
How would I make the arm retract and latch onto the object?
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
changing the size using distance from object.
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!
local re = game.ReplicatedStorage:WaitForChild(“OnGrabRE”)
local mouse = game.Players.LocalPlayer:GetMouse()
local cam = workspace.CurrentCamera
local hrp = script.Parent:WaitForChild(“HumanoidRootPart”)
local rarm = script.Parent:WaitForChild(“Right Arm”)
local target = nil
local rHeld = false
mouse.Button1Down:Connect(function()
local mouseTarget = mouse.Target
if mouseTarget and mouseTarget:FindFirstChild("CanGrab") then
re:FireServer(mouseTarget)
target = mouseTarget
end
end)
mouse.Button1Up:Connect(function()
re:FireServer(target, true)
end)
game:GetService(“UserInputService”).InputBegan:Connect(function(inp, processed)
if not processed and inp.KeyCode == Enum.KeyCode.R and target then
rHeld = true
end
end)
game:GetService(“UserInputService”).InputEnded:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.R then
rHeld = false
end
end)
game:GetService(“RunService”).Heartbeat:Connect(function()
if target and target.CanGrab.Value == script.Parent.Name then
local pos = hrp.Position + (mouse.Hit.Position - hrp.Position).Unit * 8
target.BodyPosition.Position = pos
print(mouse.Hit.Position - hrp.Position)
rarm.Size = Vector3.new(1,4,1)
target.BodyGyro.CFrame = target.CFrame
if rHeld then
target.BodyGyro.CFrame = target.BodyGyro.CFrame * CFrame.Angles(0, 0.1, 0)
end
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.