Hey there, i want to spawn a wall in front of the player when this function is called, but im getting the error:
attempt to index nil with CFrame - line 25
What should i change to make the script work?
The localscript is in the StarterPlayerScripts
local function StopPlayer()
local direction = rootPart.CFrame.LookVector
local wallPosition = rootPart.Position + direction
local wall = Instance.new("Part")
wall.Size = Vector3.new(4, 8, 0.5)
wall.CFrame = CFrame.new(wallPosition)
wall.Parent = game.Workspace
end