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

game.ReplicatedStorage.tool.Changed:Connect(function()
    if r.Value == 1 then
    gui.SCPONE.Visible = true
    wait (2)
    gui.SCPONE.clear.Visible = true
    wait (2)
    gui.SCPONE.Frame.ImageLabel.Visible = true
    wait (3.5)
    gui.SCPONE.Visible = false
    game.ReplicatedStorage.tool:FireServer(g)
    end
    end)

Server

game.ReplicatedStorage.tool.OnServerEvent:Connect(function(player,g,h)
    if g then
        print ("its g time to give a tool named g")  game.ReplicatedStorage.g.Parent = player

    elseif  h then
        print ("its h time to give a tool named h") game.ReplicatedStorage.h.Parent = player
    end
end)

Answer this question