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

Tool Giver Gui Not functioning properly?

Asked by 4 years ago

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)
1
:connect() is deprecated use :Connect(). :clone() is deprecated use :Clone() NiniBlackJackQc 1562 — 4y
0
Thanks I wasn't aware, but it didn't fix it NxvaRBLX 16 — 4y
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. superawesome113 112 — 4y
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. superawesome113 112 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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
You're an actual lifesaver, thanks! NxvaRBLX 16 — 4y
Ad

Answer this question