I’m more than likely just forgetting, but I need to make it send the text from the player’s gui to the server script. How can I do this?
Code:
Note: The text is in a text box thats in the same screen gui.
-- Screen Gui Button
local debounce = false
script.Parent.MouseButton1Click:Connect(function()
if debounce == false then
debounce = true
game.ReplicatedStorage.myHotel.GiveCard:FireServer()
wait(2)
debounce = false
end
end)
-- Server Script
game.ReplicatedStorage.myHotel.GiveCard.OnServerEvent:Connect(function(Player, Text)
if game.ServerStorage.myHotel.CurrentRooms.Value >= game.ServerStorage.myHotel.MaxRooms.Value then
print("Cannot give room! Hotel is at max capacity.")
else
local card = game.ServerStorage.myHotel.Card:Clone()
card.Name = game.ServerStorage.myHotel.CurrentRooms.Value +1
card.Parent = Player.Backpack
game.ServerStorage.myHotel.CurrentRooms.Value = game.ServerStorage.myHotel.CurrentRooms.Value +1
end
end)
I think I’m just being stupid but I’m not sure still.
Code:
-- Gui Script (Local)
local debounce = false
local TextBox = script.Parent.Parent.Parent.User.TextBox
script.Parent.MouseButton1Click:Connect(function()
if debounce == false then
debounce = true
game.ReplicatedStorage.myHotel.GiveCard:FireServer(TextBox.Text)
wait(2)
debounce = false
end
end)
-- Server Script (Script)
game.ReplicatedStorage.myHotel.GiveCard.OnServerEvent:Connect(function()
if game.ServerStorage.myHotel.CurrentRooms.Value >= game.ServerStorage.myHotel.MaxRooms.Value then
print("Cannot give room! Hotel is at max capacity.")
else
local card = game.ServerStorage.myHotel.Card:Clone()
card.Name = game.ServerStorage.myHotel.CurrentRooms.Value +1
card.Parent =
game.ServerStorage.myHotel.CurrentRooms.Value = game.ServerStorage.myHotel.CurrentRooms.Value +1
end
end)
-- Screen Gui Button
local debounce = false
script.Parent.MouseButton1Click:Connect(function(Player)
if debounce == false then
debounce = true
local text = script.parent.text
game.ReplicatedStorage.myHotel.GiveCard:FireServer(Player, text)
wait(2)
debounce = false
end
end)
Just line the codes properly , I only use mobile lol