I’m currently working on a magnet in a game where you collect objects. This is the script of the magnet itself:
while true do
wait(1)
for i,v in pairs(game.Workspace.ObjSpawningScript.SpawnedObjects:GetChildren()) do
if (Hum.Position - v.Position).Magnitude < 24 then
local Attach = Instance.new("Attachment")
local Attach1 = Instance.new("Attachment")
Attach.Parent = Hum
Attach1.Parent = v
local force = Instance.new("LineForce")
force.Parent = Hum
force.Attachment0 = Attach1
force.Attachment1 = Attach
force.ReactionForceEnabled = false
force.MaxForce = 500
end
end
end
It does the job, however, very glitchy.
What I mean by glitchy is that the object makes contact with the HumanoidRootPart of the player, and player can climb on the object and replicate a ladder effect.
Is there a way to do this ? I have considered making the object uncollidable, but my game relies on .Touched() events to see when player collects a hat.
Much appreaciation.