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

When "Vividex" joins hat give won't work?

local JJ = game.ReplicatedStorage.JJ

function onEnter(player) end
	if (player).name == "Vividex" then do
		JJ.Parent = player
	end
end

this is probably no wear near to close of what i thought pretty much suck at scripting i put the jj hat in replicatedstorage and made a function when i join it takes the hat and puts it on me probably not even close lol please help? i also am trying to make it repeat on death

1 answer

Try this one:

local JJ = game.ReplicatedStorage.JJ

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		if player.Name == "Vividex" then
			JJ:Clone().Parent = player
		end
	end)
end)

You wrote a function in a script and as what tutorial says, the function is useless without being triggered. You must just write onEnter() for it to work.

The script I wrote has its event listener so that when the event occur, the function will too.

1 comment

0

Nothing happens when I join the game:-(

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