Basically I'm designing a hotel-like system where it sends a message to the server and then to all players that a room has been taken. It works but only for the first button, and I can't figure out how to tell the server which button was pressed.
Localscript:
r201.MouseButton1Down:Connect(function() if roombought == false then roombought = true rt:FireServer(r201) elseif roombought == true then r201.Text = "X" end end) r202.MouseButton1Down:Connect(function() if roombought == false then roombought = true rt:FireServer(r202) elseif roombought == true then r202.Text = "X" end end) r301.MouseButton1Down:Connect(function() if roombought == false then roombought = true rt:FireServer(r301) elseif roombought == true then r301.Text = "X" end end) r302.MouseButton1Down:Connect(function() if roombought == false then roombought = true rt:FireServer(r302) elseif roombought == true then r302.Text = "X" end end)
ServerScript:
rt.OnServerEvent:connect(function(player, r201,r202,r301,r302) print "testserver" if r201 then local tag = Instance.new("StringValue") tag.Name = "StringValue" tag.Parent = r201 rtc:FireAllClients() end if r202 then local tag = Instance.new("StringValue") tag.Name = "StringValue" tag.Parent = r202 rtc:FireAllClients() end if r301 then local tag = Instance.new("StringValue") tag.Name = "StringValue" tag.Parent = r301 rtc:FireAllClients() end if r302 then local tag = Instance.new("StringValue") tag.Name = "StringValue" tag.Parent = r302 rtc:FireAllClients() end end)
I'm trying to tell the serverscript via arguments (which I assume I'm using wrong) which room was bought by putting the value in the parenthesis of "fireserver" in the localscript. Then I'm checking to see if it was indeed put in the arguments, which should fire the correct part of the serverscript, which then sends it to another localscript (thats how it's supposed to work in my head, anyways). Like I said, the 1st button works totally fine and when a 2nd player presses the 2nd button, it too works. But if you skip one the localscript doesn't fire to the correct part of the serverscript.
That may have been super confusing, but any and all help would be appreciated!