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

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

Asked by 5 years ago

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.

0
Could you explain it a bit, when specific player enters or? karlo_tr10 1233 — 5y
0
No, just when I enter. I don't want this to be seen at all unless I'm in the game. TheQuickestJimmy 2 — 5y

1 answer

Log in to vote
0
Answered by
Yuuwa0519 197
5 years ago
Edited 5 years ago

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

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? TheQuickestJimmy 2 — 5y
0
This example will work anywhere(except for replicatedstorage and serverstorage), but if you want everyone to see change i would recommend serverscriptservice. Yuuwa0519 197 — 5y
Ad

Answer this question