Ad
Log in to vote
0

How would I make a brick always appear on the right side of my avatar?

Asked by 5 years ago

I tried CFraming the position of the brick, but when i turn around and open the screen it appears on my left or right in front of me.. Could you guide me please?

function openScreen()
    if deb == false then deb = true
        wait()
        chr.Humanoid.WalkSpeed = 0
        local sb = game.ReplicatedStorage.inventoryScreen
        local sb2 = sb:Clone()
        sb2.Parent = chr
        sb2.CFrame = chr.Head.CFrame + Vector3.new(6,0,-2) --Right here is the prob
        plr.PlayerGui.UI.Adornee = sb2
        plr.PlayerGui.UI.container.Visible = true
    end
end

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Try using CFrame.new instead of Vector3.new. Like this

function openScreen()
    if deb == false then deb = true
        wait()
        chr.Humanoid.WalkSpeed = 0
        local sb = game.ReplicatedStorage.inventoryScreen
        local sb2 = sb:Clone()
        sb2.Parent = chr
        sb2.CFrame = chr.Head.CFrame + CFrame.new(6,0,-2) --Right here is the prob
        plr.PlayerGui.UI.Adornee = sb2
        plr.PlayerGui.UI.container.Visible = true
    end
end

If that does not work, then your facing the wrong way. Either way. I hope this helps!

Ad

Answer this question