Selection issues

-- Server
remote4.OnServerEvent:Connect(function(plr,hit,selected)
if selected == "Bullet" then
        for i = 1, 500 do
            print("pew")
            task.wait(0.25)
        end
    elseif selected == "Missile" then
        for i = 1, 20 do
            print("boom")
            task.wait(0.5)
        end
    elseif selected == "Nuke" then
        print("Nuke")
    end
-- Client
local selected = nil
local function selection(button)
    if selected ~= nil then
        selected.Text = string.gsub(selected.Text, " <", "")
    end
    button.Text = (button.Text .. " <")
    selected = button
end

The client just sets selected to whatever the name of the button I click and sends it to the server script
though what happens is that the server completely ignores the whole block of code above. help would be appreciated

By the looks of the selection() function and according to what you said, “…Sets selected to whatever the name of the button I click and sends it to the server script,” your problem may be that you are passing selected (an Instance) as an argument through the RemoteEvent, and not selected.Name.

I believe that if you print an object, the value of its Name property will be outputted in the console. For example, this common snippet:

Players.PlayerAdded:Connect(function(player)
    print("Player joined:", player)
end)

This is probably why you think selected is equivalent to button’s Name.