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

, Player.Name not working? Error COde: Expected 'then' got '='

I'm making a Staff GUI and when I address a certain person(myself) to open the Staff GUI, out comes this:

if player.Name = "TheMightyHisez" then

the error code is on the =. it says Expected 'then' got '='

my whole code:

game.Players.PlayerAdded:Connect(function(player) if player.Name = "TheMightyHisez" then script.Parent.Parent.Parent.Visible = true end end)

--this is when you have to make the text go through the chat, also being invisible to other players aswell. HELP MEH

script.Parent.MouseButton1Down:Connect(function()

bc = BrickColor.new("Dark stone grey")

game.StarterGui:SetCore("ChatMakeSystemMessage", {

Text = :fly player.Name;

Font = Enum.Font.Cartoon;


Color = bc.Color;

FontSize = Enum.FontSize.Size96;

Visible = false

})

end

end)

end

end

please help me

1 comment

0

Please format your code

4 answers

Use == for if and this isn't C# you don't put a ; at the end of every line. I don't even know what you are doing...

Hey,


if player.Name = "TheMightyHisez" then

should be

if player.Name == "TheMightyHisez" then

= is an Assignment Operator it is used to assign the value of variable or expression, while == is an Equal to Operator and it is a relation operator used for comparison

As for the rest of the code, its not properly formatted, so I won't be looking at it.

EDIT: Not too sure what you're trying to accomplish with using FireServer() from the server??

1 comment

0

sorry about that, and THANK YOU SO MUCH for the help. you have helped me a lot. Thanks!

script.Parent.MouseButton1Down:Connect(function()

bc = BrickColor.new("Dark stone grey")

game.StarterGui:SetCore("ChatMakeSystemMessage", {

Text = :fly player.Name;


Font = Enum.Font.Cartoon;


Color = bc.Color;



FontSize = Enum.FontSize.Size96;	


Visible = false

})

end

end)

end

end

the format is here. Im just a starter in roblox studio. I combined AlvinBlox's tutorial on System Messages into this. This is probably completely utterly wrong.

Actually, That video wasn't for making ":" commands. Here's a tutorial for what you want:

Tutorial

Hope this works!

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