I have a partial script that reacts when you touch it but i want it to spawn a clone of the player that touches it at a specific location. Any help would be appreciated :P
Here is the script:
local button = game.Workspace.ArenaSpawn local function createclone(other) local parent = other.Parent if game.Players:GetPlayerFromCharacter(parent)then end end button.Touched:connect(createclone)
Script after doing what i think you told me lol :
local button = game.Workspace.ArenaSpawn local function createclone(player) local parent = player.Parent --Clone player local Clone = parent:Clone() Clone.Parent = game.workspace Clone:MoveTo(button.Position) end button.Touched:connect(createclone)
Here's your current script:
local button = game.Workspace.ArenaSpawn local function createclone(other) local parent = other.Parent if game.Players:GetPlayerFromCharacter(parent)then end end button.Touched:connect(createclone)
So you would like a script that would create a clone of the player that touches it. Continuing on on your script, you have already started the part on the button being touched. With that part out of the way, here is how you would clone.
In your script, other, is the hit, which would be the body part of the player. Thus, parent, would be the player. I do suggest you change its name to "Player" to avoid confusion. Anyway, in order to clone, you should use Clone() which will be used to clone the player. After cloning, place the clone into workspace. And finally, to move a model, in this case, a clone, you should use MoveTo() to move the clone to your desired location, in this case, the button.
Here's the new edit, find for the one you'd like:
local button = game.Workspace.ArenaSpawn local Done = false local function createclone(other) humanoid = other.Parent:FindFirstChild("Humanoid") if humanoid and not Done then local player = other.Parent player.Archivable = true --Clone player local Clones = player:Clone() Clones.Parent = game.Workspace Clones:MoveTo(button.Position) player.Archivable = false Done = true end end button.Touched:connect(createclone)
local button = game.Workspace.ArenaSpawn local Done = false local function createclone(other) humanoid = other.Parent:FindFirstChild("Humanoid") if humanoid and not Done then Done = true wait(1) local player = other.Parent player.Archivable = true --Clone player local Clones = player:Clone() Clones.Parent = game.Workspace Clones:MoveTo(button.Position) player.Archivable = false Done = false end end button.Touched:connect(createclone)