Hello guys, its been some days that i posted on the forum.
I have an issue, my script does not work and it has no error.
I have named the circles 1 - 9, all of them are sorted, and im making math.random so when u click some you lose (just change text to “”).
I tried it with remote events and also local scripts and server scripts, none of them seem to work neither getting any errors from the console.
robloxapp-20220828-1910058.wmv (529.0 KB)
this is the vid inside studio, and the script is here:
local selCeasy = false
local selCmedium = false
local selChard = false
local client = game.Players.LocalPlayer
local aEasy = client.PlayerGui.MainUI.Main.TowerGame.easy:GetAttribute("selected")
local aMedium = client.PlayerGui.MainUI.Main.TowerGame.medium:GetAttribute("selected")
local aHard = client.PlayerGui.MainUI.Main.TowerGame.hard:GetAttribute("selected")
local function checkSelected()
if aEasy == true then
selCeasy = true
selCmedium = false
selChard = false
end
if aMedium == true then
selCmedium = true
selCeasy = false
selChard = false
end
if aHard == true then
selChard = true
selCmedium = false
selCeasy = false
end
end
script.Parent.MouseButton1Click:Connect(function()
checkSelected()
wait(0.5)
if selCeasy == true then
local tower1 = math.random(1, 3)
local tower2 = math.random(4, 6)
local tower3 = math.random(7, 9)
client.PlayerGui.MainUI.Main.TowerGame.TowerEasy:FindFirstChild(tower1).MouseButton1Click:Connect(function()
client.PlayerGui.MainUI.Main.TowerGame.TowerEasy:FindFirstChild(tower1).Text = "❌"
end)
client.PlayerGui.MainUI.Main.TowerGame.TowerEasy:FindFirstChild(tower2).MouseButton1Click:Connect(function()
client.PlayerGui.MainUI.Main.TowerGame.TowerEasy:FindFirstChild(tower2).Text = "❌"
end)
client.PlayerGui.MainUI.Main.TowerGame.TowerEasy:FindFirstChild(tower3).MouseButton1Click:Connect(function()
client.PlayerGui.MainUI.Main.TowerGame.TowerEasy:FindFirstChild(tower3).Text = "❌"
end)
end
end)
Thanks for ur help!
Goodbye!
INFO: Buttons Easy, Medium and Hard have an Attribute. Its called “selected” and is a boolean. But in the client player gui and starter gui everything is deselected, even if i selected it with scripts.
example of the easy one:
local easy = script.Parent.Parent.easy:GetAttribute("selected")
local hard = script.Parent.Parent.hard:GetAttribute("selected")
local medium = script.Parent.Parent.medium:GetAttribute("selected")
local function clearAllAttributesExceptThisOne()
hard = false
script.Parent.Parent.hard.BackgroundColor3 = Color3.fromRGB(50, 61, 77)
script.Parent.Parent.hard.Text = "Select hard"
script.Parent.Parent.TowerHard.Visible = false
medium = false
script.Parent.Parent.medium.BackgroundColor3 = Color3.fromRGB(50, 61, 77)
script.Parent.Parent.medium.Text = "Select medium"
script.Parent.Parent.TowerMedium.Visible = false
end
script.Parent.MouseButton1Click:Connect(function()
clearAllAttributesExceptThisOne()
wait(.1)
easy = true
script.Parent.Parent.TowerEasy.Visible = true
print("set to easy")
script.Parent.BackgroundColor3 = Color3.fromRGB(75, 75, 255)
script.Parent.Text = "Easy selected"
end)