Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

1 comment

0

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

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.