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

What's wrong with this code?

I would like this code to change the colour of the baseplate when a player enters. Honestly, I kinda just guess at it because it is my second script (My first was also today) and I am just trying to have some fun learning how to script.

local function player()
	game.Workspace.BasePlate.BrickColor = ("Bright blue")
end

I also need another line at the end for when players join, as I am unsure as to what I need. Thanks!

2 answers

If you want this to happen when a player enters, read up on what Events are and the PlayerAdded event. This script would do it for you.

Game:GetService("Players").PlayerAdded:connect(function(plr)
	Workspace.BasePlate.BrickColor = BrickColor.new("Bright blue")
end)

1 comment

0

I missed that detail >.> , "When Player Enters".

local function player() game.Workspace.BasePlate.BrickColor = BrickColor.new("Bright blue") end

4 comments

0

Thanks!

1

In future, please use the lua syntax highlighter when answering a question with code. Press the lua logo in the answer area to insert this,

1

This won't occur when a player enters and it won't even occur if you don't call player().

0

dude, rate me down? It was one line and I was answering it quickly. Gosh, thought you were cool, artic...

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