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

Why won't this one line in my script move the part to the location I want it to?

Asked by 5 years ago
local IdleTorso = {"Hurtbox", 0, 0.95, -0.175, 2, 1.2, 2.35}

function onPlayerAdded(player)
    local Hitboxes = player:FindFirstChild("Hitboxes")
    local character = player.Character or player.CharacterAdded:Wait()
    if character  and not Hitboxes then
        wait(5)
        print("Creating Hitboxes for " .. player.Name)
        local Root = character.HumanoidRootPart
        if Root then
            local Hurtbox = Instance.new("Part")
            Hurtbox.Name = IdleTorso[1]
            Hurtbox.CanCollide = false
            Hurtbox.Transparency = 1
            Hurtbox.Size = Vector3.new(IdleTorso[5], IdleTorso[6], IdleTorso[7])
            Hurtbox.Orientation = Vector3.new(Root.Orientation.X, Root.Orientation.Y, Root.Orientation.Z)
            Hurtbox.Position = Vector3.new(Root.Position.X, Root.Position.Y + IdleTorso[3], Root.Position.Z) -- not working????
            local HBOutline = Instance.new("SelectionBox")
            HBOutline.Adornee = Hurtbox
            HBOutline.Color3 =  Color3.fromRGB(5, 0, 172)
            HBOutline.LineThickness = 0.01
            HBOutline.SurfaceTransparency = 1
            if Hurtbox and HBOutline then
                local weld = Instance.new("Weld")
                weld.Part0 = Hurtbox
                weld.Part1 = Root
                weld.Parent = Root
                HBOutline.Parent = Hurtbox
                Hurtbox.Parent = character
            end
        end
    end
end

Alright, so I managed to create a table of various values that I needed to create specific parts in certain places for my game. Everything works... except for one single line, and that's the one that's marked with a comment. I've tried pretty much everything to get that one line to work. I've made entirely new values that correspond to the values in the table, and used those to add to the HumanoidRootPart's position, I've tried making two separate values and adding them together, and I've even written in my own values for the entire thing. Nothing has worked so far. Anyone have any ides as to why this one line in my script just doesn't seem to work?

Answer this question