Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Reducing tool drop distance? (Hopperbin)

Asked by
Turgon 80
8 years ago

I made a sword by using a hopperbin and pressing the 'e' button makes the hopperbin drop at where the mouse is, i was wondering about how i could limit the furthest point it can be dropped to WITHOUT stopping the drop action. Basicly, i still want it to drop in the same direction but i only want it to drop (let's say) 5 studs far from the player. How can i accomplish this?

mouse.KeyDown:connect(function(key)
    key = string.lower(key)
    if key == "e" and holding then --holding is a value that's equal to true if the hopperbin is selected
        Delete() --Deletes the parts of the sword from the character
        FixArm() --This is supposed to remove the weld that's holding the right arm, but it makes it fall in online mode :c
        tool.Parent = workspace
        tool.Active = false
        if (char.Torso.CFrame.p - mouse.Hit.p).magnitude > dropdistance then --dropdistance == 5
            model._Handle.CFrame = mouse.Hit * CFrame.new(0,5,0)
        end
    end
end)
--NOTE: the sword model inside the character is a clone of the actual model inside the hopperbin, so i delete the clone one and put the real one into the workspace. The idea is that you can take and drop weapons.
0
Provide your script and i can fix it. I know what you need to do, but a more understandable answer will be provided if we get the script to edit on. Never be worried about anything to put it on here - we aren't going to steal it. And if we were to steal it, it would probably require us to shape the game for the script, or the script itself could be completely unrelated. TL;DR Show, Don't Worry. Marios2 360 — 8y
0
Edited :p Turgon 80 — 8y

Answer this question