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

Help with GUI Toolgiver?

This script works fine, just the last part.

gui = script.Parent

connector = Workspace.GUI

button = script.Parent.Giver

Tool = game.Lighting.BrownBessV1

close = script.Parent.Close

print("Killer's Musket Giver V1 is active!")

function OnC()
	wait()
	print("Connecting...")
	if connector.Value == 1 then print("Value is 1!")
		gui.Visible = true
	else
		gui.Visible = false
		print("Value is 0!")
	end
end

function Give(Plr)
	print("Activated")
	plr = game.Players.LocalPlayer
	wait()
	print("Giving...")
	wait(1)
	Tool1 = Tool:clone()
	Tool1.Parent = Plr.Backpack
end

close.MouseButton1Click:connect(function()
	gui.Visible = false

end)

connector.Changed:connect(OnC)
button.MouseButton1Click:connect(Give)

This part doesn't seem to work correctly. It only works when I do it on a Test server. When I enter an actual server with my actual username, it doesn't give you the tool when you click the tool GUI button.

function Give(Plr)
	print("Activated")
	Plr = game.Players.LocalPlayer
	wait()
	print("Giving...")
	wait(1)
	Tool1 = Tool:clone()
	Tool1.Parent = Plr.Backpack
end

How do I properly definite "Plr?"

1 comment

0

Also, do not duplicate.

1 answer

The problem is that the actual player is not an argument of mousebutton1down. MouseButton1Down returns a POSITION not a Player.

function Give()
    print("Activated")
    local Plr = game.Players.LocalPlayer
    wait()
    print("Giving...")
    wait(1)
    Tool1 = Tool:clone()
    Tool1.Parent = Plr.Backpack
end

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