Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

A script that's supposed to give items is not working? [Answered]

I made a little script where you click a button then you get some tools. But, the problem is that the tools aren't appearing in the player's backpack! This problem has happend before to me aswell..

script.Parent.MouseButton1Click:connect(function()
	local move1 = script.Parent.Weapon
	local move2 = script.Parent.Weapon2
	local moveStorage = workspace.Moves
	local plr = script.Parent.Parent.Parent.Parent.Parent.Parent

	local one = moveStorage:FindFirstChild(move1.Value):Clone()
	local two moveStorage:FindFirstChild(move2.Value):Clone()
	one.Parent = plr.Backpack
	two.Parent = plr.Backpack
end)

Okay I fixed the problem with the 2nd move. I needed an =. It apparently just works online, thought move2 doesn't get cloned now...

4 comments

0

Most likely a problem with the Hierarchy. Check line 5 and to see if it actually returns the Player.

0

it doesnt...

0

WELL! FOR SOME WEIRD REASON, IT ONLY WORKS ONLINE! YAY..

0

except move2 doesn't get cloned

1 answer

script.Parent.MouseButton1Click:connect(function()
    local move1 = script.Parent.Weapon
    local move2 = script.Parent.Weapon2
    local moveStorage = workspace.Moves
    local plr = script.Parent.Parent.Parent.Parent.Parent.Parent

    local one = moveStorage:FindFirstChild("Weapon"):Clone() -- Changed value to weapon name
    local two moveStorage:FindFirstChild("Weapon2"):Clone() -- Ditto.
    one.Parent = plr.Backpack
    two.Parent = plr.Backpack
end)

I'm not sure if your move1 and move2 are values? If they are, then you can use move1.Value. If they're items/objects, you can use move1.Name and move2.Name.

1 comment

0

they're values.

This discussion is preserved as it was. New answers, comments, and votes are closed.