roblox-local.lua
· 920 B · Lua
Raw
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local toggleReady = ReplicatedStorage:WaitForChild("ToggleReady")
local screen = Instance.new("ScreenGui")
screen.ResetOnSpawn = false
screen.Parent = player:WaitForChild("PlayerGui")
local button = Instance.new("TextButton")
button.AnchorPoint = Vector2.new(0.5, 0.5)
button.Position = UDim2.fromScale(0.5, 0.8)
button.Size = UDim2.fromOffset(220, 56)
button.Parent = screen
local function render()
local ready = player:GetAttribute("Ready") == true
button.Text = ready and "Ready ✓" or "Ready up"
button.BackgroundColor3 = ready
and Color3.fromRGB(70, 190, 110)
or Color3.fromRGB(70, 90, 120)
end
button.MouseButton1Click:Connect(function()
toggleReady:FireServer()
end)
player:GetAttributeChangedSignal("Ready"):Connect(render)
render()
| 1 | local Players = game:GetService("Players") |
| 2 | local ReplicatedStorage = game:GetService("ReplicatedStorage") |
| 3 | |
| 4 | local player = Players.LocalPlayer |
| 5 | local toggleReady = ReplicatedStorage:WaitForChild("ToggleReady") |
| 6 | |
| 7 | local screen = Instance.new("ScreenGui") |
| 8 | screen.ResetOnSpawn = false |
| 9 | screen.Parent = player:WaitForChild("PlayerGui") |
| 10 | |
| 11 | local button = Instance.new("TextButton") |
| 12 | button.AnchorPoint = Vector2.new(0.5, 0.5) |
| 13 | button.Position = UDim2.fromScale(0.5, 0.8) |
| 14 | button.Size = UDim2.fromOffset(220, 56) |
| 15 | button.Parent = screen |
| 16 | |
| 17 | local function render() |
| 18 | local ready = player:GetAttribute("Ready") == true |
| 19 | button.Text = ready and "Ready ✓" or "Ready up" |
| 20 | button.BackgroundColor3 = ready |
| 21 | and Color3.fromRGB(70, 190, 110) |
| 22 | or Color3.fromRGB(70, 90, 120) |
| 23 | end |
| 24 | |
| 25 | button.MouseButton1Click:Connect(function() |
| 26 | toggleReady:FireServer() |
| 27 | end) |
| 28 | |
| 29 | player:GetAttributeChangedSignal("Ready"):Connect(render) |
| 30 | render() |