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

How do I make something only appear when I enter the game?

I've been toying with this idea a lot, and was hoping for some feedback. I'm really new still, and have no idea how I would even begin to do this.

2 comments

0

Could you explain it a bit, when specific player enters or?

0

No, just when I enter. I don't want this to be seen at all unless I'm in the game.

1 answer

If you are trying to do specific thing when you join, you can check the userid of player. For example, this code will spawn a block when you enter.

local myUserId = -1  --Replace it with your userid. Here, I use the Player1's userid. 

local Players = game:GetService("Players")

local part = Instance.new("Part") --thing to insert. it can be model, union, whatever you want.


Players.PlayerAdded:Connect(function(player)
	if player.UserId == myUserId then
		--Write your own function here.Mine is just a example.
		clone = part:Clone()
		clone.Parent = workspace
	end
end

--EDIT-- If you want the event to end if when you leave, you can use the Players.PlayerRemoving function.

Players.PlayerRemoving:Connect(function(player) if player.UserId == myUserId then clone:Destroy() end end

2 comments

0

Alright, where would I put this script? And what happens to the block when I leave? Can I use this on multiple parts at once? Can I use it on unions?

0

This example will work anywhere(except for replicatedstorage and serverstorage), but if you want everyone to see change i would recommend serverscriptservice.

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