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

Help with GUI Toolgiver?

Asked by 10 years ago

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?"

0
Also, do not duplicate. Lacryma 548 — 10y

1 answer

Log in to vote
0
Answered by
Lacryma 548 Moderation Voter
10 years ago

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
Ad

Answer this question