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

How can I find an equipped tool from a gui?

Asked by 4 years ago
Edited 4 years ago

localscript inside buttongui: local plr = game:GetService("Players").LocalPlayer

local char = plr.Character

local button = script.Parent

local pack = plr.Backpack

local tool = pack.Constructor

local debounce = false



button.MouseButton1Click:Connect(function()

if char:WaitForChild("Minerals").Value <= 249 then

return

end

if char:WaitForChild("Minerals").Value >= 250 and not debounce then

debounce = true

tool.Handle.SpawnerData:FireServer()

end

end)

normal script inside tool:

script.Parent.SpawnerData.OnServerEvent:Connect(function()

print("event fired")

end)

I was trying to fire a remote event at an equipped tool so it can spawn a model, but the tool disappears from the players backback when equipped. this is annoying because I need to be able to access the tool from a gui. is there a way around this issue?

0
You need to include the server codes aswell User#24403 69 — 4y
0
When a tool is equipped, it is automatically parented into the player's character Ankur_007 290 — 4y

Answer this question