grabbed = false
currentPlayer = ""
part = script.Parent.Parent
script.Parent.Triggered:Connect(function(player)
if grabbed == false then
currentPlayer = player.Name
local head = player.Character.Head
local x = head.CFrame.X
local y = head.CFrame.Y
local z = head.CFrame.Z
part.CFrame = CFrame.new(x,y,z)
part.CFrame = part.CFrame + head.CFrame.LookVector * 4
part.Massless = true
grip = Instance.new("WeldConstraint")
grip.Part0 = head
grip.Part1 = part
grip.Parent = head
script.Parent.ActionText = "Drop"
part.CanCollide = false
grabbed = true
-- DROP --
else
if player.Name == currentPlayer then
grip:Remove()
currentPlayer = ""
part.Massless = false
part.CanCollide = true
script.Parent.ActionText = "Pick Up"
grabbed = false
end
end
end)
this is a script for picking things up, through a proximity prompt, iām wondering, how should i convert this script to work upon clicking something by clickdetector instead?