I’m trying to make a script that clones a simple model into the user in the workspace. (if possible)
I’ve looked for other posts but they aren’t exactly what I need I’ve tried some scripts but non worked.
Here’s one I’ve tried, Please know I’m not very good at scripting.
local plrservice = game.Players
local plr = plrservice.PlayerAdded
local book = game.ReplicatedStorage.Book
local user = game.Workspace.LocalPlayer
plr:connect(function()
book:Clone()
book.Parent = user
end)
Also, I do know now that you cant use LocalPlayer like that,
local plr = game:GetService("Players").LocalPlayer --get the localplayer
local char = plr.Character or plr.CharacterAdded:Wait() --if the player's character didn't load yet, then wait for it
local item = game.ReplicatedStorage:WaitForChild("insert item name here"):Clone() --clone the item from ReplicatedStorage
item.Parent = char -- set the parent to the player's character
what exactly are trying to do? are you welding the book to the player or are you simply cloning it?
ok, if the game is r15 then try something like this:
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local item = game.ReplicatedStorage:WaitForChild("insert item name here"):Clone()
item.Parent = char
local rightHand = char:WaitForChild("RightHand") --get the player's right hand
local rightWrist = rightHand.RightWrist --get the player's righthand motor6d
item:SetPrimaryPartCFrame(rightWrist.C0) --set the item's cframe to the righthand's motor6d
-- if the item doesn't have a primarypart then this won't work
if you’re confused on PrimaryParts then you can look here for reference or help
I recommend using WeldConstraints instead of the Weld Instance because it allows for two object to be welded together without having to set the CFrames of the individual weld instances