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

What's wrong with this code?

Asked by 10 years ago

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

Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

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)
0
I missed that detail >.> , "When Player Enters". HexC3D 830 — 10y
Ad
Log in to vote
-1
Answered by
Ripull 45
10 years ago

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

0
Thanks! 17fred20 10 — 10y
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, Articulating 1335 — 10y
1
This won't occur when a player enters and it won't even occur if you don't call player(). Ekkoh 635 — 10y
0
dude, rate me down? It was one line and I was answering it quickly. Gosh, thought you were cool, artic... Ripull 45 — 10y

Answer this question