0% found this document useful (0 votes)
73 views2 pages

LocalScript (Placed in StarterPl

The document is a LocalScript for a Roblox game that manages UI frames and updates based on player teams. It retrieves frames from a specific folder and changes their background color when an event is triggered. Additionally, it updates the background color of a text element based on the player's team affiliation, specifically for teams named 'Sanders' and 'Bluemans'.

Uploaded by

supermariogod95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views2 pages

LocalScript (Placed in StarterPl

The document is a LocalScript for a Roblox game that manages UI frames and updates based on player teams. It retrieves frames from a specific folder and changes their background color when an event is triggered. Additionally, it updates the background color of a text element based on the player's team affiliation, specifically for teams named 'Sanders' and 'Bluemans'.

Uploaded by

supermariogod95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

-- LocalScript (placed in StarterPlayerScripts)

local player = game.Players.LocalPlayer -- Get the local player


local frameEvent = game.ReplicatedStorage:WaitForChild("FrameEvent")
local frameIndex = 1

-- Retrieve frames dynamically


local function getFrames()
local frames = {}
local playerGui = player:WaitForChild("PlayerGui") -- Ensure PlayerGui exists
local pointGui = playerGui:WaitForChild("PointGui") -- Ensure PointGui exists
local aFolder = pointGui:WaitForChild("A") -- Ensure A folder exists

for i = 1, 6 do
local frame = aFolder:FindFirstChild("A" .. i)
if frame then
table.insert(frames, frame)
else
warn("Frame A" .. i .. " not found!")
end
end
return frames
end

-- Function to update AText background color based on the player's team


local function updateATextBackgroundColor()
local playerGui = player:WaitForChild("PlayerGui") -- Ensure PlayerGui exists
local pointGui = playerGui:WaitForChild("PointGui") -- Ensure PointGui exists
local aFolder = pointGui:WaitForChild("A") -- Ensure A folder exists
local aText = aFolder:FindFirstChild("AText") -- Find the AText button

-- Directly set background color based on player's team


if aText then
if player.Team and player.Team.Name == "Sanders" then
aText.BackgroundColor3 = Color3.fromRGB(255, 255, 0) -- Yellow
print("Set AText background color to Yellow (Sanders team)")
elseif player.Team and player.Team.Name == "Bluemans" then
aText.BackgroundColor3 = Color3.fromRGB(0, 0, 255) -- Blue
print("Set AText background color to Blue (Bluemans team)")
end
else
warn("AText not found!")
end
end

local frames = getFrames()

-- Listen for the event from the server to update frames


frameEvent.OnClientEvent:Connect(function()
if frameIndex <= #frames then
local frame = frames[frameIndex]
frame.BackgroundColor3 = Color3.fromRGB(255, 255, 0) -- Change color to
Yellow
frame.Visible = true -- Make it visible
print("Updated frame " .. frame.Name .. " to Yellow")

frameIndex = frameIndex + 1 -- Move to the next frame


else
print("All frames have been processed.")
-- Update the AText background color after all frames are processed
updateATextBackgroundColor()
end
end)

You might also like