I have a code that I'm trying to use where if a certain player joins, it will make a new sparkles instance inside the torso of that player. Here's what I have, but it's not working. I'm testing this in Roblox Studio, so the name is Player.
game.Players.PlayerAdded:connect(function(plr) local name = plr.Name if name == "Player" then sparkles = Instance.new("Sparkles", game.Workspace.Player.Torso) sparkles.Enabled = true sparkles.SparkleColor = (255, 255, 0) end end)
Your error is setting the color, you tried to set a Color3
value as a non-Color3
value.
game.Players.PlayerAdded:connect(function(plr) local name = plr.Name repeat wait() until plr.Character -- Wait for character local char = plr.Character if name == "Player1" then --The name for a player in studio is Player1. local sparkles = Instance.new("Sparkles", char.Torso) sparkles.Enabled = true sparkles.SparkleColor = Color3.new(255, 255, 0)--Error here end end)
Onrespawn
game.Players.PlayerAdded:connect(function(plr) --Define Player plr.CharacterAdded:connect(function(char) --Define Character local name = plr.Name if name == "Player1" then local sparkles = Instance.new("Sparkles", char.Torso) sparkles.Enabled = true sparkles.SparkleColor = Color3.new(255, 255, 0) end end) end)