How do I make an anti-noclip script

It does work for me, did you make sure to insert it into StarterCharacterScripts?

Edit: Yeah here is how it should look like

1 Like

Put what in StarterCharacterScripts? I added the model into my game and it tells me to keep the only script in workspace.

Ok. Nvm, I figured it out. It works almost flawlessly with parts, but it has a false positive which is going through terrain water. How do I fix that?

1 Like

Ok nvm. I found a fix for it. just checked if the material was water. Simple fix :+1:

Ok nvm. It turns out doing that it completely broke the noclip script at all.
I added
and not Hit.Material == Enum.Material.Water
to it and it gives a blue line error that seys this.
image
W000: (7,43) Generic Luau error: Type Enum.Material cannot be compared with == because it has no metatable

OK so I fixed it again by using ~= instead of not but apparently its detecting terrain but when I check the material name it says it’s plastic

you can just check if the material isn’t made of the material that is not supposed to be clipped by the player

I’m sorry but did you read anything I said prior? I have three posts right before you explicitly suggesting checking the material doesn’t work.

It detects water as plastic, but still detects it as a material which is weird.

A common no-clip script uses Humanoid:ChangeState(), maybe by detecting this change in the client (unsafe, but may prevent people that just copy scripts!), you could detect if the new state is the Noclip (11). Some scripts don’t use this for noclipping but this should prevent a few exploiters.

local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.FilterDescendantsInstances = {Character}
raycastParams.IgnoreWater = true
local raycastResult = workspace:Raycast(Origin, Destination - Origin, raycastParams)

Use the raycastParams.IgnoreWater

1 Like

This is the first thing I said on the OP


The script I’m using uses Ray.new

How do I put raycastparams in there

Use WorldRoot | Documentation - Roblox Creator Hub

local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.FilterDescendantsInstances = {Character}
raycastParams.IgnoreWater = true
local raycastResult = workspace:Raycast(OldRootPosition, HumanoidRootPart.Position - OldRootPosition, raycastParams)
if raycastResult then
	HumanoidRootPart.CFrame = CFrame.new(OldRootPosition)
end

or try

Hit = workspace:FindPartOnRayWithIgnoreList(Raycast, Character:GetDescendants(), false, true)

2 Likes

Theres a property on FindPartOnRay which ignores water.

workspace:FindPartOnRay(ray,ignoreObject,false,true) 
2 Likes

Messiah!!!

A while ago I was thinking have making an anti-noclip script and I was to lazy to verify my roblox account so yeah.

Where exactly do I put it? Sorry if this is a stupid question.

Inside your Loop / RunService but make sure u already made a ray

Ok, thanks a lot. This is very helpful.