So I have a button in a GUI that if you press it, here's what it does:
wait()
local player = game.Players.LocalPlayer
local Button = script.Parent
local CreateSeverF = script.Parent.Parent
local AddServerF = script.Parent.Parent.Parent.AddServerFrame
local CreateServer = game.ReplicatedStorage:WaitForChild("CreateServer")
local ownsGamepass = GetService(_MarketplaceService_)_UserOwnsGamePassAsync(player.UserId,15934847)
local CreateListButton = script.Parent.Parent.Parent.ServerList.AddServer
Button.MouseButton1Click:Connect(function()
if ownsGamepass then
local ServerName = script.Parent.Parent.ServerNameInput.ServerName.Value
local ServerInitials = script.Parent.Parent.ServerInitialsInput.Initials.Value
if ServerName and ServerInitials ~= "" then
CreateListButton:Destroy()
AddServerF:Destroy()
CreateSeverF.Visible = false
print("Creating "..ServerName.." Server!")
local ServerName = script.Parent.Parent.ServerNameInput.ServerName.Value
local ServerInitials = script.Parent.Parent.ServerInitialsInput.Initials.Value
CreateServer:FireServer(ServerName, ServerInitials)
print("Fired Event")
else
print("Invalid Strings!")
script.Parent.Parent.ServerInitialsInput.Roundify.ImageColor3 = Color3.fromRGB(191, 0, 0)
script.Parent.Parent.ServerNameInput.Roundify.ImageColor3 = Color3.fromRGB(191, 0, 0)
script.Parent.Parent.ServerInitialsInput.Text = ""
script.Parent.Parent.ServerNameInput.Text = ""
print("Reseted Text Values")
end
else
print("You need a gamepass!")
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,15934847)
print("Prompted Purchase")
end
end)
**Then** it goes through a Server Script:
local CreateServer = game:GetService("ReplicatedStorage"):WaitForChild("CreateServer")
CreateServer.OnServerEvent:Connect(function(ServerName, ServerInitials)
CreateServer:FireAllClients(ServerName, ServerInitials)
end)
After that it returns to the gui in a script
wait()
local MainFrame = script.Parent.MainFrame
local ServerList = MainFrame.ServerList
local event = game:GetService("ReplicatedStorage"):WaitForChild("CreateServer")
local template = game:GetService("ReplicatedStorage"):WaitForChild("roomtemp")
local buttontemplate = game:GetService("ReplicatedStorage"):WaitForChild("ServerButtonTemp")
event.OnClientEvent:Connect(function(ServerName, Initials)
local clone = template:Clone()
clone.Parent = MainFrame
clone.ServerName.Value = ServerName
clone.ChannelsFrame.Name.GetName.Disabled = false
clone.Visable = false
print("Made Room")
print("Starting Button")
local buttonclone = buttontemplate:Clone()
buttonclone.Parent = ServerList
buttonclone.ServerFrame.Value = clone
buttonclone.Initials.Value = Initials
buttonclone.SetInitials.Disabled = false
buttonclone.Open.Disabled = false
print("Finished making"..ServerName.."!" )
end)
And lastly I get this error in the console:
Players.HopeRox.PlayerGui.Wizzard.ServerDisplay:12: invalid argument #3 (string expected, got Instance) - Client - ServerDisplay:12
I NEED HELP IDK WHATS WRONG??

1 comment
You should read dev API too.