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

How to send a tool name to server from client? (Remote Events)

Asked by 5 years ago

Basically once the reward gui is done i want the client to send the tool name to the server then the server will pick it up and give the player the tool

Client

01game.ReplicatedStorage.tool.Changed:Connect(function()
02    if r.Value == 1 then
03    gui.SCPONE.Visible = true
04    wait (2)
05    gui.SCPONE.clear.Visible = true
06    wait (2)
07    gui.SCPONE.Frame.ImageLabel.Visible = true
08    wait (3.5)
09    gui.SCPONE.Visible = false
10    game.ReplicatedStorage.tool:FireServer(g)
11    end
12    end)

Server

1game.ReplicatedStorage.tool.OnServerEvent:Connect(function(player,g,h)
2    if g then
3        print ("its g time to give a tool named g")  game.ReplicatedStorage.g.Parent = player
4 
5    elseif  h then
6        print ("its h time to give a tool named h") game.ReplicatedStorage.h.Parent = player
7    end
8end)

Answer this question