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

how to make wall be in front of player all time?

Asked by 5 years ago

hello beautiful people hope you are having a blessed day i'm making so if the thing is equipped the wall is in front if the player but it is always just next to the player can somebody please help

here is the script

script.Parent.Equipped:Connect(function()
    script.Parent.Value.Value = false
    wait(0.01)
    local building = game.Players.LocalPlayer.PlayerGui.building.Value
    local clone  = game.ReplicatedStorage[building]:Clone()
    clone.Parent = game.Workspace
    local guiclone = script.Parent.ScreenGui:Clone()
    guiclone.Parent = game.Players.LocalPlayer.PlayerGui
    repeat
    local X = script.Parent.Part.Position.X
    local Y = script.Parent.Part.Position.Y
    local Z = script.Parent.Part.Position.Z +5
    local x = script.Parent.Part.Orientation.X
    local y = script.Parent.Part.Orientation.Y
    local z = script.Parent.Part.Orientation.Z

    clone:SetPrimaryPartCFrame(CFrame.new(Vector3.new(X,Y,Z)))
    wait(0.1)
    until script.Parent.Value.Value == true
        clone:Destroy() 
        guiclone:Destroy()  
end)

script.Parent.Unequipped:Connect(function()
    script.Parent.Value.Value = true
end)

help

0
while true do wait(), a loop can be useful, or render stepped run service, or even check if the player moved. greatneil80 2647 — 5y

1 answer

Log in to vote
1
Answered by
OnaKat 444 Moderation Voter
5 years ago
Edited 5 years ago

Easy use CFrame.

local orientation = clone.Orientation
repeat
    local stud = 0 -- change this if you want your wall higher(+) or lower(-)
    clone.CFrame = game.Players.LocalPlayer.Character.Head.CFrame *CFrame.new(0,(-4.5)+(clone.Size.Y/2)+stud,5)
    clone.Orientation = orientation
    wait(0.1)
until script.Parent.Value.Value == true
Ad

Answer this question