0

# How do you fetch the players name in a script (More context when clicked)?

Im making it so that theres a model in server storage and it has a script inside of it and what im trying to do with that script is that it gets a players name then gets the character then places the model in the players position. Then using another script that when clicked it will clone model and put in in workspace. This is the script which is in the model

local brickBlast = script.Parent

for i,v in pairs(game.Players:GetPlayers()) do

wait()

local player = v.Name

brickBlast.PrimaryPart = brickBlast.Center
brickBlast:SetPrimaryPartCFrame(CFrame.new(player.Character.HumanoidRootPart.Position))


end

0

A little unsure about what you're exactly looking for but you can get the player and the character like this

-- runs every time a new player joins
-- runs whenever the character spawns

game.ServerStorage.BrickBlast:SetPrimaryPartCFrame(character.PrimaryPart.CFrame)