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

Why do I get so much hopperbins?

Asked by
neoG457 315 Moderation Voter
9 years ago
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Mouse.KeyDown:connect(function(key)
if key == "q" then

local   backpack = game.Players.LocalPlayer.Backpack
local Slice1 = game.ReplicatedStorage.Slam:Clone()
Slice1.Parent = backpack

end
    end)

Every time I click q I get the hopperbin I need but I also end up getting around 10 of them instead of just 1. This script clones a Hopperbin named "Slam" and puts it in my Backpack. How do I stop it from cloning lots of Hopperbins and only 1

1 answer

Log in to vote
0
Answered by 9 years ago

Hmm. You should check if someone already has the hopperbin.

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Mouse.KeyDown:connect(function(key)
if key == "q" then
local   backpack = game.Players.LocalPlayer.Backpack
local Slice1 = game.ReplicatedStorage.Slam:Clone()
if Slice1.Parent == backpack then
print("User already has Slice1!")
else
Slice1.Parent. = backpack
wait(0.5) -- Added that just in case.
end
end
    end)

There's the revised script. If this helped, be sure to upvote/accept the answer! c;

0
It doesnt seem to work, it just gives the slam tool ever 0.5 seconds. neoG457 315 — 9y
0
I didnt downvote btw neoG457 315 — 9y
Ad

Answer this question