Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago
Edited 4 years ago

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

0
Please format your code Thetacah 712 — 4y

4 answers

Log in to vote
1
Answered by 4 years ago

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...

Ad
Log in to vote
0
Answered by
Thetacah 712 Moderation Voter
4 years ago
Edited 4 years ago

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??

0
sorry about that, and THANK YOU SO MUCH for the help. you have helped me a lot. Thanks! TheMightyHisez 5 — 4y
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

Log in to vote
0
Answered by
B_rnz 171
4 years ago

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

Tutorial

Hope this works!

Answer this question