This is a script I am using to weld a part (The parts name is "Middle" in the script) to my right hand. but whenever I make the part too big, I teleport to the parts location and my character freezes, Any thoughts? ps: "Rasenshurikan" is the model where the Middle part (the one I'm having trouble with) is located. Also this is my first question so please correct me if I'm doing something wrong.
local enabled = true
Player = game.Players.LocalPlayer
Character = Player.Character
local Service = game:GetService("UserInputService")
Service.InputBegan:connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.X then
if enabled == true then
enabled = false
local o = script.Rasenshurikan.Middle
game:GetService("Chat"):Chat(Player.Character.Head, "Rasenshurikan!")
local hum = Player.Character.Humanoid
local Animation2 = hum:LoadAnimation(script.RasenshurikanAnim)
local current2 = Animation2
current2:Play()
wait(.5)
local g = script.Rasenshurikan:Clone()
g.Parent = Player.Character
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "Part" or C[i].className == "UnionOperation" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Name = "Weld"
Y.Part0 = Player.Character["RightHand"]
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, -5, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
if enabled == false then
wait(3)
Player.Character.Rasenshurikan:Destroy()
wait(4)
enabled = true
end
end
end
end
end
end)
If you need a visual representation of my problem, please go to this --> https://gyazo.com/4d6d6aabf0c6ef8aa7e81c2143c84033 Thanks! -A scrpting newbie
