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

Weld not forming from Instance.new?

Asked by 5 years ago

I want to weld a part to a HumanoidRootPart but I checked the HumanoidRootPart for a weld, and it wasn't there. I switched the parent and Part0 to the part it self and the weld wasnt in there either. Any help? I'm using Mouse.KeyDown for now to test how I want this to be, and I'll eventually switch to UserInputService.

My InvokeServer script

local player = game.Players.LocalPlayer
local CAS = game:GetService("ContextActionService")
local UIS = game:GetService("UserInputService")
local char = player.Character or player.CharacterAdded:Wait()
local BlazeRF = game.ReplicatedStorage.BlazeInvoke
local debounce = false
local Mouse = player:GetMouse()
local animation = script:WaitForChild("Animation")
    local hum = char:WaitForChild("Humanoid")
    animTrack = hum:LoadAnimation(animation)

Mouse.KeyDown:Connect(function(key)
    key = key:lower()
    if key == "q" then
        if not debounce then
            debounce = false

        BlazeRF:InvokeServer(Mouse.Hit.p)
        ButtonDown = Instance.new("BoolValue")
        ButtonDown.Name = "ButtonDown"
        ButtonDown.Value = true
        ButtonDown.Parent = char

        bg = Instance.new("BodyGyro")
        bg.D = 100
        bg.Parent = char.Torso
        bg.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
        bg.CFrame = CFrame.new(char.Torso.Position, Mouse.Hit.p)
        bg.Name = "MouseGyro"


        bp = Instance.new("BodyPosition")
        bp.Parent = char.Torso
        bp.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
        bp.Position = char.Torso.Position
        bp.Name = "TorsoPosition"






        if ButtonDown.Value == true then



            for i = 1, 110 do

                bg.CFrame = CFrame.new(char.Torso.Position, Mouse.Hit.p)
                animTrack:Play()
                wait()

            if i == 110 then

                animTrack:Stop()
                bg:Destroy()
            end

            if ButtonDown.Value == false then
                bg:Destroy()
                animTrack:Stop()
            end
            end




        end





        wait(2)

        debounce = false
        end
    end
    end)

Mouse.KeyUp:Connect(function(key)
    key = key:lower()
    if key == "q" then
        ButtonDown.Value = false
        bg:Destroy()

        bp:Destroy()
        animTrack:Stop()
    end
end)

My ServerScript

game.ReplicatedStorage.BlazeInvoke.OnServerInvoke = function(plr, MouseHit)

    print("Working!")
    --Variables--
    local char = plr.Character
    print(char)
    local RootPart = char:WaitForChild("HumanoidRootPart")
    local animation = script:WaitForChild("Animation")
    local hum = char.Humanoid
    animTrack = hum:LoadAnimation(animation)
    local hitdebounce = false
    repeat wait() until char
    circle = game.ReplicatedStorage.MagicItems.MagicCircles.BlazeMagic.BlazeCircle:Clone()
        circle.Size = Vector3.new(1.353, 1.3, 0.265)
        circle.Parent = game.Workspace.CustomDebris
        circle.Anchored = true
        circle.CanCollide = false
        circle.Transparency = 1
        circle.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(1.5,0,-2)

    local Weld = Instance.new("Weld")
        Weld.Parent = RootPart
        Weld.Part0 = RootPart
        Weld.Part1 = circle
        Weld.C0 = CFrame.new(1.5,0,-2)
        print(Weld.Part1)
        repeat wait() until Weld
        for i = 1, 15 do

            circle.Size = circle.Size + Vector3.new(.4,.4,0)


            wait()


            end



end
1
why are you doing repeat wait() until Weld, that overcomplicates things User#19524 175 — 5y
1
You can't change the size without destroying the weld, the weld remains up to the `circle` changing in size Vulkarin 581 — 5y
0
Oh yeah! Thanks for reminding me.. ScrubSadmir 200 — 5y
0
Mhm Vulkarin 581 — 5y

Answer this question