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

Tool Giver Gui Not functioning properly?

So, I made a tool giving gui, it's activated by clicking a part, which then brings up the gui. It appeared to be working at first, but when I tested it with my friends, we noticed that only we could see our own weapons on our screens, and we couldn't see eachothers, also, the scripts within the tools are meant to sit down any character it hits, this script didn't work when the tool was given through the gui.

This is the localscript under the textbutton, which gives the tool BaseballBat is the tool

local p = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect (function()
	local tool = script.Parent.BaseballBat:clone()
	tool.Parent = p.Backpack
end)

4 comments

1

:connect() is deprecated use :Connect(). :clone() is deprecated use :Clone()

0

Thanks I wasn't aware, but it didn't fix it

0

Try using script.Parent.MouseButton1Click:Connect(function(plr), Make sure to not use a space between the function part and the Connect part. Instead of using local p use a player thing.

0

Also I don't think that you using the right syntax.You'd need to use a local BaseballBat = Xplace.BaseballBat, You'd most likely also need to use something like a GUI or something.

1 answer

✓ Accepted answer

If you doesn't see your friend tools it's because you have distributed them with the clients worlds. ROBLOX have inserted FilteringEnabled, the client can't send information to the server so you must use RemoteEvent.

What is RemoteEvent?

Link to dev page

How to realise my script?

Put a RemoteEvent on ReplicatedStorage, name that "ToolGiverRequest". Put your tool on ReplicatgedStorage

Make a script (ServerScript) and put them on ServerScriptService, writte that on your ServerScript

local RStorageService = game:GetService('ReplicatedStorage')

RStorageService.ToolGiverRequest.OnServerEvent:Connect(function(p)
	RStorageService.BaseballBat:Clone().Parent = p.Backpack
end)

Your LocalScript (ClientScript) is now

local RStorageService = game:GetService('ReplicatedStorage')

script.Parent.MouseButton1Click:Connect(function()
	RStorageService.ToolGiverRequest:FireServer()
end)

Try that

1 comment

1

You're an actual lifesaver, thanks!

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