Hi guys, i want to introduce my new model that makes you pick something!
Setup
-
Make sure you use a click detector (or a proximity prompt if you want)
-
Create a server script in your block you want and put this script:
local ClickDetector = script.Parent.ClickDetector -- Or a proximity Prompt
local Hold = script:WaitForChild("Hold")
local RS = game:GetService("ReplicatedStorage")
local HoldTrack
local PS = game:GetService("Players")
local HoldEvent = RS:WaitForChild("HoldEvent")
ClickDetector.MouseClick:Connect(function(Player) -- If you want a proximity prompt select your proximity prompt variable, and put ".triggered".
local LeftArm = Player.Character:WaitForChild("Left Arm")
local Humanoid = Player.Character:WaitForChild("Humanoid")
local Weld = Instance.new("WeldConstraint")
HoldTrack = Humanoid:LoadAnimation(Hold)
script.Parent.CFrame = LeftArm.CFrame + Vector3.new(0, -1.5, 0)
ClickDetector.MaxActivationDistance = 0
Weld.Parent = script.Parent
Weld.Part0 = script.Parent
Weld.Part1 = LeftArm
HoldTrack:Play()
script.Parent.Anchored = false
script.Parent.CanCollide = false
HoldEvent:FireClient(Player)
HoldEvent.OnServerEvent:Connect(function()
Weld:Destroy()
script.Parent.CanCollide = true
HoldTrack:Stop()
ClickDetector.MaxActivationDistance = 10
end)
end)oldEvent = RS:WaitForChild("HoldEvent")
ClickDetector.MouseClick:Connect(function(Player) -- If you want a proximity prompt select your proximity prompt variable, and put ".triggered".
local LeftArm = Player.Character:WaitForChild("Left Arm")
local Humanoid = Player.Character:WaitForChild("Humanoid")
local Weld = Instance.new("WeldConstraint")
HoldTrack = Humanoid:LoadAnimation(Hold)
script.Parent.CFrame = LeftArm.CFrame + Vector3.new(0, -1.5, 0)
ClickDetector.MaxActivationDistance = 0
Weld.Parent = script.Parent
Weld.Part0 = script.Parent
Weld.Part1 = LeftArm
HoldTrack:Play()
script.Parent.Anchored = false
script.Parent.CanCollide = false
HoldEvent:FireClient(Player)
HoldEvent.OnServerEvent:Connect(function()
Weld:Destroy()
script.Parent.CanCollide = true
HoldTrack:Stop()
ClickDetector.MaxActivationDistance = 10
end)
end)
-
Make sure you have a hold animation inside the pickup script, and its name is “Hold”
-
Make sure your game is R6
-
And finally, insert a script inside starter character scripts and put this script:
local RS = game:GetService("ReplicatedStorage")
local HoldEvent = RS:WaitForChild("HoldEvent")
local UIS = game:GetService("UserInputService")
local DB = false
HoldEvent.OnClientEvent:Connect(function()
DB = false
UIS.InputBegan:Connect(function(input, gp)
if gp then return end
if input.KeyCode == Enum.KeyCode.E then
if DB == false then
DB = true
HoldEvent:FireServer()
end
end
end)
end)
Now your done!
Examples
Here’s a video of what it looks like:
Feedback
Feel free to leave your feedback!
- Good
- Mid
- Bad
0 voters