Can someone please show me where my mistake is?

So i’m trying to make a Police/Prisoner type like jailbreak here is my code

I would like to know what isn’t it making work, I’ve dubble checked everything and It still doesn’t work, Hopefully there is a answer to my question.
Code:


local menuButton

local frame = script.Parent:WaitForChild("Frame")

--Team colours

local PoliceColor = "DarkBlue"

local PrisonerColor = "Bright Orange"

frame.Prisoner:MouseButton:connect (function()

RemoteEvent:fireserver(BrickColor.new(PrisonerColor))

end)

frame.Police:MouseButton:connect (function()

RemoteEvent:fireserver(BrickColor.new(PrisonerColor))

end)```

First off, it’s generally much more helpful to trace the issue as far as you can and ask a more specific question.

Second, the issue may be incorrect capitalization of the FireServer() calls. Try fixing that.

1 Like

Alright, I’ll see if it fixes anything. Thanks.

Perfect, thanks. I saw it didn’t work because of the FireServer() wasn’t capitalized
Thanks, it worked like a charm.
Edit: thanks for pointing it out I didn’t see the mistake.

1 Like

oof

don’t eyeball it actually read the docs


You have many mistakes here.

Your zeroth mistake is that you don’t use the output because your code has a syntax error. frame.Prisoner:MouseButton:connect is not valid syntax. So it won’t work at all.

how to view output
  1. Go to view
    image

  2. Click output

One, There is no color DarkBlue. The color is called Dark blue. Lua is case sensitive like pretty much every other language.

Two, Bright orange is the color, not Bright Orange. Again, case sensitivity.

Third, the event you want to listen for clicks is Activated. I don’t know how your current code is working when no event MouseButton exists.

local frame = script.Parent:WaitForChild("Frame")

--Team colours

local PoliceColor = "Dark blue"

local PrisonerColor = "Bright orange"

frame.Prisoner.Activated:Connect(function() -- :connect is deprecated, switch to :Connect
    RemoteEvent:FireServer(BrickColor.new(PrisonerColor))
end)

frame.Police.Activated:Connect(function()
    RemoteEvent:FireServer(BrickColor.new(PrisonerColor))
end)
3 Likes