Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game.ReplicatedStorage:WaitForChild("OnGrabRE").OnServerEvent:Connect(function(plr, target, dropping)
- if not target then return end
- if dropping then
- target:SetNetworkOwner(nil)
- for i, child in pairs(target:GetChildren()) do
- if child:IsA("BodyGyro") or child:IsA("BodyPosition") then
- child:Destroy()
- end
- end
- target.CanGrab.Value = ""
- elseif target:FindFirstChild("CanGrab") and target.CanGrab.Value == "" then
- local distance = (plr.Character.HumanoidRootPart.Position - target.Position).Magnitude
- if distance > 15 then return end
- target.CanGrab.Value = plr.Name
- if not target:FindFirstChild("BodyPosition") then
- local bp = Instance.new("BodyPosition", target)
- bp.D = 100
- bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- end
- if not target:FindFirstChild("BodyGyro") then
- local bg = Instance.new("BodyGyro", target)
- bg.D = 100
- bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
- end
- target.Anchored = false
- target:SetNetworkOwner(plr)
- end
- end)
Add Comment
Please, Sign In to add comment