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

Expected identifier when parsing expression, got then?

I got this error and I don't know what I did wrong. I searched the error up online and got no results. I've also tried removing ends and adding ends. I need help, thanks.

local ReplicatedStorage = game:GetService('ReplicatedStorage')

local remoteEvent = ReplicatedStorage:WaitForChild('ShowPlayer')

local players = game.Players.Stage



textColor = BrickColor.new('Lime green')

if players.Value = 40 then
	local function complete(playerName, partName)

		game.StarterGui:SetCore('ChatMakeSystemMessage', {

			Text = playerName..' completed '..partName;

			Font = Enum.Font.SourceSansBold;

			Color = textColor.Color;

			FontSize = Enum.FontSize.Size24;

		})

	end

	remoteEvent.OnClientEvent:Connect(complete)
end

1 answer

The error is due to line 11, checking for equivalency is ==, assigning a value is =. I fixed your script but fairly certain this still wont work due to line 5, do you have a player named Stage? If this is a localscript get the LocalPlayer.

local ReplicatedStorage = game:GetService('ReplicatedStorage')

local remoteEvent = ReplicatedStorage:WaitForChild('ShowPlayer')

local players = game.Players.Stage

local function complete(playerName, partName)

	game.StarterGui:SetCore('ChatMakeSystemMessage', {

	Text = playerName..' completed '..partName;

	Font = Enum.Font.SourceSansBold;

	Color = textColor.Color;

	FontSize = Enum.FontSize.Size24;

	})

end

textColor = BrickColor.new('Lime green')

if players.Value == 40 then
    remoteEvent.OnClientEvent:Connect(complete)
end

2 comments

0

i made a mistake in line 5 its supposed to be

0

local players = game.Players.leaderstats.Stage

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