So I've been trying to get a part to spawn above a random player, and I've tried a bunch of different scripts with various errors, most recently getting a " randomPlayer is not a valid member of DataModel " error.
Here's my code, any advice would be greatly appreciated.
local randomPlayer = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
while true do
wait(1)
part = script.Parent.Debris:clone()
part.Parent = script.Parent
part.Anchored = true
part.Position = game.randomPlayer.Character.Torso.Position
end

1 comment
Thank you so much, it took me a bit, but finally got it working (Was getting a lot of errors about the character not existing in Workspace)