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

How do I add a new object every time a player joins?

Asked by
W0_0SH 65
2 years ago

So I want to make it so that every time a player gets added a new part gets added as well, but I just can't get it to work (only adds a new part once), here's my script (server script)

local part = game.Workspace.Part
local partClone = part:Clone()
local ps = game:GetService("Players")

ps.PlayerAdded:Connect(function()
    partClone.Parent = game.Workspace
    partClone.Anchored = false
    partClone.Position = Vector3.new(0, part.Position.Y + 1.3, 0)
end)

1 answer

Log in to vote
0
Answered by
W0_0SH 65
2 years ago

Apart from asking a dumb question I managed to make the script finally which just makes a new part instance every time a player joins instead of cloning an object provided. here's the script if any one is interested

game:GetService("Players").PlayerAdded:Connect(function()
    local part = Instance.new("Part")
    part.Parent = game.Workspace
    part.Position = Vector3.new(0,0.5,0)
end)
Ad

Answer this question