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

Help me with my cloning please?

Asked by
neoG457 315 Moderation Voter
9 years ago
local Player = game.Players.LocalPlayer

local Mouse = Player:GetMouse()
        Mouse.KeyDown:connect(function(key)


    if key == "v" then 

        Player = script.Parent.Parent

        game.Workspace.WorkspaceRinkakuModel:MakeJoints()

        local WRM = game.workspace.WorkspaceRinkakuModel

        local RinkakuModel = WRM:Clone()

        RinkakuModel.Parent = workspace
        RinkakuModel.Name = Player.Name

local   w = Instance.new('Weld')
        w.Part0 = RinkakuModel
        w.Part1 = Player.Character.Torso
        w.Parent = RinkakuModel
        w.C0 = CFrame.new(0, 0, 0)*CFrame.new(0, 0, 0)





    end
        end)



This script should make a clone of WorkspaceRinkakuModel (Which Is In Workspace, Of Course) and weld it to my torso whenever I press V. But it doesnt seem to work and I dont know whats wrong with it, there are no visible errors and the script is a localscript in starterpack. Help please?

0
Change WorkspaceRinkakuModel's CFrame to the torso's Position. EzraNehemiah_TF2 3552 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

There are a couple of evident problems. First off, you use makejoints on the initial model whenever you press v instead of the clone. Makejoints should be called on the clone after creating the weld. You should also use debounce so that you can't repeatedly clone your model. It's probably also a good idea to parent the clone to the character instead of workspace, and you should consider putting the model to clone inside of ReplicatedStorage.

Finished Script

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local debounce = false

Mouse.KeyDown:connect(function(key)
if key == "v" and not debounce then
debounce = true
local RinkakuModel = game.ReplicatedStorage.RinkakuModel:Clone() --Assuming the model is now in ReplicatedStorage
local   w = Instance.new('Weld')
w.Part0 = RinkakuModel.PrimaryPart
w.Part1 = Player.Character.Torso
w.Parent = RinkakuModel
w.C0 = CFrame.new(0, 0, 0)*CFrame.new(0, 0, 0)
RinkakuModel.Parent = Player.Character
RinkakuModel:MakeJoints()
RinkakuModel.Name = Player.Name
end
end)

Comment if the code doesn't work for you, and I'll see what I might've done wrong.

0
Sorry, but its still not working. The model is in replicatedstorage neoG457 315 — 9y
0
I see you're problem. You're welding the model to the torso. I'll have to edit it later, I've gotta go somewhere. Try setting Part0 to the primary part of the model. aquathorn321 858 — 9y
Ad

Answer this question