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

How do I make Sparkles come off of Certain players Heads?

I have been trying to make it so that whenever my fellow dev or I enter a server for the game, sparkles appear around our heads. So far, this is what I've got: function ifDevEntered(player) local dev = ( player.Name("DevSupremecy") or player.Name("Dev_Noobity") ) if dev then local sparkle = Instance.new("Sparkles") sparkle.Enabled = true sparkle.Parent(player.Character.Head) sparkle.SparkleColor(255, 0, 0) end end I think I've got the API calls right, so I think the problem's with the IF-THEN statement.

1 answer

✓ Accepted answer

LocalScript:

devs = {
	"name1",
	"name2",
	"name3",
	"name4"
}

plr = game.Players.LocalPlayer
wait(1)
local head = plr.Character:FindFirstChild("Head")
for i = 1, #devs do
	if (string.lower(plr.Name) == string.lower[devs[i])) then
		local sparkles = Instance.new("Sparkles",head)
		sparkles.SparkleColor = Color3.new(255/255, 0/255, 0/255)
	end
end

Script:

devs = {
	"name1",
	"name2",
	"name3",
	"name4"
}

game.Players.PlayerAdded:connect(function(plr)
	wait(1)
	local head = plr.Character:FindFirstChild("Head")
	for i = 1, #devs do
		if (string.lower(plr.Name) == string.lower(devs[i])) then
			local sparkles = Instance.new("Sparkles",head)
			sparkles.SparkleColor = Color3.new(255/255, 0/255, 0/255)
		end
	end
end)

2 comments

0

What would I use the LocalScript for?

0

If you place the LocalScript inside StarterGui or StarterPack, the script will run each time the player is respawned. The regular script will only run after a player has joined the game, so if they died and respawned, the sparkles won't appear.

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