Hello all,
I have a question here. I've recently turned on FilteringEnabled in my place so I'm changing the scripts. I am confused if I should use a RemoteEvent or RemoteFunction. What I want to happen is that whenever the button in the gui is pressed the RemoteEvent/Function is passed on and that should give the player (which will be in a textbox) an item. But I do not know whether I should use a RemoteEvent or Function and how the code in the RemoteEvent/Function will work.
PS: I have already read all wiki threads about this and tried everything and it still does not work. I have also already tried changing to a RemoteFunction. In case you're wondering, nothing is showing up in the output.
Here's the code in the gui:
script.Parent.confirm.MouseButton1Click:connect(function(player)
game.ReplicatedStorage.GiveRoom:FireServer(player)
end)
Here's the code in the RemoteEvent:
script.Parent.OnServerEvent:connect(function(player)
local reception = player:WaitForChild('PlayerGui').Reception.FrameA.CheckIn
if reception.errormsg.Text == "Error: Room not available" then
warn("Room not available") else
if game.Players[reception.username.Text] then
game.ServerStorage.ReceptionSystem.RoomsFolder["Room"..reception.roomnum.Text].Value = true
local newVal = Instance.new("StringValue", game.ServerStorage.ReceptionSystem.CheckedIn)
newVal.Name = "Room"..reception.roomnum.Text
newVal.Value = game.Players[reception.username.Text].Name
local newKey = game.ServerStorage.ReceptionSystem.Card:Clone()
newKey.Parent = game.Players[reception.username.Text].Backpack
newKey.Name = "Room "..reception.roomnum.Text
newKey.CardNumber.Value = reception.roomnum.Text
local newKey2 = game.ServerStorage.ReceptionSystem.Card:Clone()
newKey2.Parent = game.Players[reception.username.Text].StarterGear
newKey2.Name = 'Room '..reception.roomnum.Text
newKey2.CardNumber.Value = reception.roomnum.Text
reception.confirm.Text = "Checked in!"
reception.roomnum.Text = "Enter room number"
reception.username.Text = "Enter username"
wait(0.5)
reception.confirm.Text = "Check-in"
end
end
reception.roomnum.Changed:connect(function()
reception.errormsg.Text = " "
if game.ServerStorage.ReceptionSystem.CheckedIn["Room"..reception.roomnum.Text] then
reception.errormsg.Text = "Error: Room not available"
end
end)
end)
Thanks in advance!

1 comment
Deploy some prints, see what isn't running that should be.