I’m having a problem in a phasing script I made where if the player phases forward into the ground they can glitch into the map, I know why it’s happening because it’s just setting the players position. Is there anything I can utilize that if there’s something within the 15 blocks that it moves forward that it makes the player only move to the edge of it?
game.ReplicatedStorage.Events.Phase.OnServerEvent:Connect(function(plr)
if game.Workspace:FindFirstChild(plr.Name) then
if plr.CanPhase.Value == true then
plr.CanPhase.Value = false
game.Workspace:FindFirstChild(plr.Name).Head.CFrame = game.Workspace:FindFirstChild(plr.Name).Head.CFrame + (game.Workspace:FindFirstChild(plr.Name).Head.CFrame.LookVector * Vector3.new(15,0,15))
wait(15)
plr.CanPhase.Value = true
end
end
end)