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

I need a variable for position to make the dummy spawn at a player. Please help?

Asked by 4 years ago

I need a variable for position in roblox

local Dummy = script.Parent
Dummy.Position = Vector3.new(humanoidRootPart.Position)

2 answers

Log in to vote
0
Answered by 4 years ago

From your question and code, I will assume you want the Dummy to go to the position of the player.

local Dummy = script.Parent
local HRP = Dummy:WaitForChild("HumanoidRootPart")
local PlayerHRP = --define your players character's HumanoidRootPart

HRP.Position = PlayerHRP.Position --you don't need Vector3.new
Ad
Log in to vote
0
Answered by
CjayPlyz 643 Moderation Voter
4 years ago
Edited 4 years ago

From your question I think you mean you want a variable for a dummy's spawn location and that you want it to be IN a random player.

local function selectplayer()
    players = game.Players:GetPlayers()
    selected = players[math.random(1,#players)]
    return selected
end

local randomplayer = selectplayers()

local randomposition = randomplayer.Character.HumanoidRootPart.Position

or

local players = game.Players:GetPlayers()

local randomposition = players[math.random(1,#players)].Character.HumanoidRootPart.Position

Answer this question