Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to make it true if one of the button is pressed?

how can i make that Criminal true if the criminal button is clicked?

local Target = {["Criminal"] = false, ["Police"] = false}
Criminal.MouseButton1Click:connect(function()
Target = {["Criminal"] = true]
end)
Police.MouseButton1Click:connect(function()
Target = {["Police"] = true]
end)
wait(1)
for i,v in pairs(game.Workspace:GetChildren()) do
if Target[v.Name] then
print(v.Parent)
end
end

this doesn't seem to work when i try to activate both, as it only prints the other 1

1 answer

✓ Accepted answer

Do it like this,

local Target = {["Criminal"] = false, ["Police"] = false}

print(Target.Criminal) -- prints false
Target.Criminal = true -- < < this
print(Target.Criminal) -- prints true

Don't do it like Target = {["Criminal"] = true ] or it will return a syntax being incorrect. And reminder, you cannot have two (2) '=' in a same line.

2 comments

0

Thanks it worked.

0

yw ;D glad i could help

This discussion is preserved as it was. New answers, comments, and votes are closed.