Hello Developers I’m trying click a Gui button to clone a model into local player and the model position is on local player humanoidrootpart position, my script right now only working clone into player model but the position is wrong place can anyone help me? thx
local ply = game:GetService("Players").LocalPlayer
local chr = ply.Character
local vfx = game.ReplicatedStorage:WaitForChild("Balls")
local hum = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
script.Parent.MouseButton1Click:Connect(function()
vfx:Clone().Parent = chr
vfx:Clone().Position = hum.Position
end)
Well uh, have you ever heard of Weld.C0 = CFrame.New()? You can try this method to edit how your model will weld your player locate at, for more informations about Weld.C0 = CFrame.New(), press this
local weld = instance.new("Weld")
weld.parent = ply.Character:FindFirstChild("HumanoidRootPart")
weld.part0 = ply.Character:FindFirstChild("HumanoidRootPart")
weld.Part1 = vfx.A_PART_INSIDE_THIS_MODEL --this must be a part inside the ball
weld.C0 = CFrame.New(x,x,x) --replace x with the numbers to make your ball at the center of the player's humanoidrootpart.
ty staying here for help, but script isn’t working for me as well
local weld = Instance.new("Weld")
weld.parent = ply.Character:FindFirstChild("HumanoidRootPart")
weld.part0 = ply.Character:FindFirstChild("HumanoidRootPart")
weld.Part1 = vfx.T --this must be a part inside the ball
weld.C0 = CFrame.New(0,0,0)
no, like you have to replace the Cframe.new(0,0,0) to random numbers until your models at the center of humanoidrootpart, this might take some times for you but here, you can move ur part by replacing x,y,z with numbers (in studs) to move them
Example : Cframe.new(1,4,2) --This move the part to the right by 1 stud, forward by 4 studs and up by 2 studs
CFrame.new(x,y,z)
x = left, right
y = front, back
z = up, down
You can use this picture to know how to
local ply = game:GetService("Players").LocalPlayer
local chr = ply.Character
local vfx = game.ReplicatedStorage:WaitForChild("Balls")
local hum = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
script.Parent.MouseButton1Click:Connect(function()
local model = vfx:clone()
model.Parent = chr
local weld = Instance.new("Weld")
weld.parent = hum --I forgot that we already have local hum
weld.part0 = hum
weld.Part1 = vfx.T
weld.C0 = CFrame.New(x,x,x) --type in random numbers until the model at the center (in studs)
end)
I probably can get something wrong at this point, let me know if i had a mistake, i will try my best to fix it.
sorry for late reply, I checked explorer the Instance.new weld isn’t working. I can’t see weld on local player humanoidrootpart when I press the Gui button maybe that a the problem. maybe I should clone weld or something.
Did you do weld.part0 and weld.part1 correspondingly? If not, do that. Otherwise the weld created would have no purpose as it is not attached to any 2 parts.
Hope this helps you. If you need any further help do contact me here on the DevForum or on Discord, solo.#0001
I’m not sure if doing this is right. I’m confusing on it
local ply = game:GetService("Players").LocalPlayer
local chr = ply.Character
local vfx = game.ReplicatedStorage:WaitForChild("Balls")
local weld = game.ReplicatedStorage:WaitForChild("Weld")
local hum = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
script.Parent.MouseButton1Click:Connect(function()
local model = vfx:clone()
local weldc = weld:Clone()
model.Parent = chr
weldc.Parent = chr.HumanoidRootPart
weldc.part0 = chr.HumanoidRootPart
weldc.Part1 = model.T
weldc.C0 = CFrame.New(1,1,1)
end