Gui given tools not working

I have this thing where when you spawn, there’s a gui on the screen to pick a weapon. It works, but the tools won’t work. I press the button, it goes to my backpack, I activate it, and nothing happens.
image
There’s no errors showing in output at all.
Also, I’m using a local script

2 Likes

You need to give it the tool via a RemoteEvent instead of the same. Your question has been posted quite a number of times by others, here’s one that I found

Although some recomemndations from that answer

  • Put your tool somewhere where only you can see it, such as a folder in ServerStorage
  • Make it work by name than by tool since exploiters can’t really see stuff in ServerStorage so they wont be able to know the names of the tools unless someone else gives them the tools, so you’d need additional checks

Localscript

local button = script.Parent
local plr = game.Players.LocalPlayer

local Event = -- Your event path here

button.MouseButton1Click:Connect(function()
	Event:FireServer("Saw")
end)

Server script

local Event = -- Your event path here
local tools = game:GetService("ServerStorage").Tools
Event.OnServerEvent:Connect(function(plr, name)
	local tool = tools:FindFirstChild(name)
	if not tool then return end
	tool:Clone().Parent = plr.Backpack
end)

Remember to Change -- Your event path here with the location of your RemoteEvent!

1 Like

Thank you i will try it
dfrkfndkdkdfdf 30

I have not really done remote events, so Im confusde

Put a RemoteEvent somewhere that both the Client and the Server can see, such as ReplicatedStorage, and in those local Event = -- Your event path here lines, change it so it references your RemoteEvent

local Event = game:GetService("ReplicatedStorage").RemoteEvent

More info on RemoteEvents

1 Like

Do I put the tool into ServerStorage? I don’t get why it says local tools = game:GetService(“ServerStorage”).Tools
Is it a folder of the tools?

It works. Thank you
gdgrhiuhedujrhegkerhgke 30

I noticed that when I click the button, it gives me multiple of the same one. I tried one event, I got all the tools. How do I fix it?

Add the tool to the backpack through the server, not the client.

I don’t think the Saw will work inside a GUI, try putting it in ReplicatedStorage instead.

A RemoteEvent shouldn’t really be needed here