Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------- Variables -----------------
- local RoomFrame = script.Parent.RoomType
- local UserFrame = script.Parent.UserName
- local SuiteButton = RoomFrame.Suite
- local StandardButton = RoomFrame.Standard
- local UserNameBox = UserFrame.UserNameBox
- local RoomFrameClose = RoomFrame.Close
- local UserFrameClose = UserFrame.Close
- local EnterUsernameButton = UserFrame.Enter
- local UserToGive
- local KeyType
- ----------------- Functions -----------------
- local function getPlayerFromPartialName(PartialName)
- local foundName = nil
- local Players = game.Players:GetPlayers()
- for i = 1, #Players do
- local PossiblePlayer = Players[i]
- if string.find(string.lower(PossiblePlayer.Name), string.lower(PartialName)) then
- foundName = PossiblePlayer.Name
- end
- end
- if not foundName then
- return nil
- else
- return foundName
- end
- end
- SuiteButton.Activated:Connect(function()
- KeyType = "Suite"
- UserFrame.Visible = true
- RoomFrame.Visible = false
- end)
- StandardButton.Activated:Connect(function()
- KeyType = "Standard"
- UserFrame.Visible = true
- RoomFrame.Visible = false
- end)
- EnterUsernameButton.Activated:Connect(function()
- local UserToGive = getPlayerFromPartialName(UserNameBox.Text)
- print(UserToGive)
- UserFrame.Visible = false
- KeyType = KeyType
- game.ReplicatedStorage.GiveRoom:FireServer(KeyType, UserToGive)
- end)
Advertisement
Add Comment
Please, Sign In to add comment