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

how to edit this script so u have no tools until u click this Gui button?

Asked by
KenzaXI 166
8 years ago
local i = script.Parent
local map = workspace.Map1.sa

function onButtonClicked()
    local plr = game.Players.LocalPlayer
    local character = plr.Character
    character:MoveTo(map.Position)
    script.Parent.Parent.Parent:Remove()
end

i.MouseButton1Down:connect(onButtonClicked)

Because I don't know much about the player properties I need help, Thanks!

1 answer

Log in to vote
0
Answered by 8 years ago

Put the tools you want to give the player inside of lighting inside of a model named "tools" And then the following...

local i = script.Parent
local map = workspace.Map1.sa

function onButtonClicked()
    local plr = game.Players.LocalPlayer
    local character = plr.Character
    character:MoveTo(map.Position)
    for _, v in pairs(game.Lighting.tools:GetChildren()) do
    v:Clone().Parent = plr.Backpack
    end
    script.Parent.Parent.Parent:Destroy()
end

i.MouseButton1Down:connect(onButtonClicked)

Also, if you're question is answered, please mark this answer as the correct answer.

0
The script works great but the Gui won't be removed now Can you fix that please? KenzaXI 166 — 8y
0
Note that Destroy() should used instead of Remove(), on your issue with the gui not being removed, you must have changed the hierarchy. (script.Parent.Parent.Parent isn't the Gui) magiccube3 115 — 8y
Ad

Answer this question