I'm making a script that will insert a falling meteor and I don't know how to place it over a random player in the workspace? would anyone mind telling me how to do that
heres my script (its for script builder)
~~~~~~~~~~~~~~~~~
l = game.Lighting local s = Instance.new("Sky") s.Parent = game.Lighting s.SkyboxBk = "http://www.roblox.com/asset/?version=1&id=1012890" s.SkyboxDn = "http://www.roblox.com/asset/?version=1&id=1012891" s.SkyboxFt = "http://www.roblox.com/asset/?version=1&id=1012887" s.SkyboxLf = "http://www.roblox.com/asset/?version=1&id=1012889" s.SkyboxRt = "http://www.roblox.com/asset/?version=1&id=1012888" s.SkyboxUp = "http://www.roblox.com/asset/?version=1&id=1014449" wait(0.1) l.FogColor = Color3.new(0, 0, 0) l.FogEnd = 1000 repeat wait(0.2) game.Lighting.FogEnd = game.Lighting.FogEnd -10 until game.Lighting.FogEnd == 100 wait(0.1) m = Instance.new("Part") m.Parent = game.Workspace f = Instance.new("Fire") f.Parent = m t = Instance.new("SpecialMesh") t.Parent = m m.Position = -- part I need help with... t.MeshId = "http://www.roblox.com/asset/?id=1290033" t.TextureId = "http://www.roblox.com/asset/?id=3197743" t.Scale = Vector3.new(3, 3, 3) ~~~~~~~~~~~~~~~~
First off, you want to get all the players in the game, like this:
local PlayerTable = game.Players:GetPlayers()
Next, you want to select a random player from that table, like this:
local ChosenPlayer = PlayerTable[math.random(1,#PlayerTable)]
Then, you want to get that player's head, like this:
repeat wait() until ChosenPlayer.Character:FindFirstChild("Head") local PlayerHead = ChosenPlayer.Character.Head
Finally, you want to position the object over the player's head, like this:
m.CFrame = CFrame.new(PlayerHead.Position + Vector3.new(0,25,0))
Hope this helped!