Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local TweenGui = require(script.Parent.TweenGui)
- local Remotes = ReplicatedStorage.Remotes
- local Player = Players.LocalPlayer
- local PlayerGui = Player.PlayerGui
- local Gui = PlayerGui:WaitForChild("Codes")
- local Frame = Gui.Frame
- local Exit = Frame.Exit
- local Open = PlayerGui:WaitForChild("Main").Right.Codes
- local Redeem = Frame.Redeem
- local TextBox = Frame.TextBox
- local function OnRedeemButtonClick()
- local Text = TextBox.Text
- if TextBox.Text ~= "" then
- Remotes.RedeemCode:FireServer(Text)
- end
- TextBox.Text = ""
- end
- Remotes.RedeemCode.OnClientEvent:Connect(function(Success: boolean, Message: string)
- if Success then
- TextBox.Text = Message
- TextBox.TextColor3 = Color3.fromRGB(70, 232, 70)
- else
- TextBox.Text = Message
- TextBox.TextColor3 = Color3.fromRGB(232, 70, 70)
- end
- task.delay(2, function()
- TextBox.Text = ""
- TextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
- end)
- end)
- Open.MouseButton1Click:Connect(function()
- if Gui.Enabled == true then
- TweenGui.CloseGui(Gui, Frame)
- else
- TweenGui.OpenGui(Gui, Frame)
- end
- end)
- Exit.MouseButton1Click:Connect(function()
- TweenGui.CloseGui(Gui, Frame)
- end)
- Redeem.MouseButton1Click:Connect(OnRedeemButtonClick)
Advertisement
Add Comment
Please, Sign In to add comment