Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

ok so, i tried finding the player model in workspace then tried cloning it?

I didnt know how to approach it so i tried this, it gives me a error saying that plr is not a valid member of workspace, how can i achieve finding the player model through a script?

The script:

local Debounce = false
local plr = game.Players.LocalPlayer.Name
local Clone = game.Workspace.plr:Clone()

function onKeyPress(actionName, userInputState, inputObject)
	if userInputState == Enum.UserInputState.Begin then
		print("Cloned")
		Clone.Humanoid:Destroy()
		Clone.Parent = game.Workspace
		Clone.Position = game.workspace.plr.Position
		
	end

end

game.ContextActionService:BindAction("keyPressSpecialName", onKeyPress, true, Enum.KeyCode.Q)
game.ContextActionService:SetPosition("keyPressSpecialName", UDim2.new(.5,0,-.5,0))
game.ContextActionService:SetImage("keyPressSpecialName", "rbxassetid://73737626")



1 answer

✓ Accepted answer

line 2 and 3 wouldn't work You cant get a players character by doing

local plr = game.Players.LocalPlayer.Name
local Clone = game.Workspace.plr:Clone()

There's 2 other ways that would work

Try

local Clone = workspace:FindFirstChild(plr)

Or

local plr = game.Players.LocalPlayer.Character
local Clone = plr:Clone()

And line 10 wouldn't work either. For line 10 try

Clone:MoveTo(YourPositionHere)

This discussion is preserved as it was. New answers, comments, and votes are closed.