How can I prevent objects from from being vulnerable to no-clip? I’ve seen in obby games like the eternal abyss where dance clipping still works, but if you try to no clip through walls, the collision of the wall isn’t off still, it doesn’t kick you or teleport you back, you just don’t no clip. How can I implement this in my obby game?
The game probably has a script that detects if the collision property is changed and automatically reactivates it. Like this:
script.Parent:GetPropertyChangedSignal("CanCollide"):Connect(function()
if script.Parent.CanCollide == false then
script.Parent.CanCollide = true
-- Remote:FireClient(Player, "CollideParts") - If the game detects that collisions are changing in only one part, it can with a RemoteEvent activate collisions in all parts to prevent problems.
end
end)
I tried something like this before, and I tried your script just now, and I can still no clip through it
For server sided stuff you could probably do some things with collision groups. Client sided stuff though, i would use game.ItemChanged (not recommended) or workspace:GetDescendants() along with workspace.DescendantAdded.
I use a player collision disabling script I found from toolbox in the game
-- Turn off player collisions script by @Omnoms_Forever
-- (With some help from an answer at https://devforum.roblox.com/t/how-to-disable-collisions-on-players/1325026/3)
-- This script is compatible with the new collision group updates as of 2023. (However, this script does NOT work before late 2022, since it uses methods featured in a 2023 update)
-- I hope this helps you in your Roblox game developing journey! You can delete all these comments EXCEPT the first and second one at the top.
-- The comments below explain what the code does, so that you can have a better understanding about exactly how it works.
plrs = game:GetService("Players") -- Get Players; this service allows us to know when a player joins the game and other player-related things
ps = game:GetService("PhysicsService") -- Get PhysicsService; this service allows us to manage collision groups
ps:RegisterCollisionGroup("plrs") -- Create collision group for players only
ps:CollisionGroupSetCollidable("plrs","plrs",false) -- Make the group not collide with other parts in that same group (This is why we create a new, seperate collision group for players; if we did this with the normal collision group, the players would fall through the world!)
plrs.PlayerAdded:Connect(function(plr) -- When a player joins,
plr.CharacterAdded:Connect(function(chr) -- wait for their character to load. Once it does,
for key,value in pairs(chr:GetDescendants()) do -- loop through the character's descendants/parts.
if value:IsA("BasePart") then -- If a descendant is found to be eligable for collision groups (If this part of the character is a body part),
value.CollisionGroup = "plrs" -- set its collision group to the players only group
end
end
end)
end)
is there anyway I can implement what you suggested in here?
if im correctly understanding what youre asking, i believe the best way is to use raycasts to compare player’s position in previous frame to player’s position in current frame, and check whether it is possible or not e.g. if anything is blocking it. youd have to do this on the server to ensure exploiters cant just delete the script
The script isnt made by me, but this one works
game:GetService("Players").PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
spawn(function()
local root = char.HumanoidRootPart
local LastVec = root.Position
game:GetService("RunService").Heartbeat:Connect(function()
local r = Ray.new(LastVec, root.Position - LastVec)
local Hit, Position = workspace:FindPartOnRayWithIgnoreList(r, {char})
pcall(function()
if Hit and Hit.CanCollide == true then
root.CFrame = CFrame.new(LastVec)
end
end)
LastVec = root.Position
end)
end)
end)
end)
in the most respectful way possible, this is not a good idea. If you have a game with many parts, you’re having to create this same event for every single individual part in your game. Also, exploiters could turn off this script very easily and just disable it from functioning at all. Also if you ever want to change the part’s CanCollide property to false, you can’t do that because this script automatically re-enables it
It teleports the player back rather than just making sure the object still is collidable, and this might falsely teleport the players back if theyre using a dance clip glitch
In an obby game with client objects, it’s not the best idea because they can falsely be flagged, and also, if you put it in an important local script that functions the game, then them deleting it would delete everything else.
It’s possible to use workspace:GetDescendants() and also use on remote and have the script keep a table of the parts I think
Sorry for late reply, but i’ve tested it with an object that is not collidable, the noclip doesn’t detect it because the script has a can collide check.
Are you making a roblox glitch-based obby? If so, you can disable the noclip, but if its not intended, you can disable the /e dance2 emote.
not glitch based, but it includes glitches. unfortunately, the only solutions I can find involves teleporting the player back. but in the game, if you try to use a no clip exploit (unless you use one thats a tool that you just fly through everything) it just doesnt work. Maybe the no clip itself is bugged? It works in other games though, but maybe it doesn’t detect all parts, not sure. But if the game is actually preventing the no clip somehow, then that’s pretty good against exploiters since most don’t use a no clip tool where you can fly through everything, so it might be efficient at preventing exploits
this seemed to have worked for me:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local conn = nil :: RBXScriptConnection?
local function onCharacterRemoved()
if not conn then
return
end
conn:Disconnect()
conn = nil
end
local function onCharacterAdded()
local Character = LocalPlayer.Character
local raycastParams = RaycastParams.new()
raycastParams:AddToFilter(Character)
local lastCF = nil
onCharacterRemoved()
conn = RunService.Heartbeat:Connect(function(delta)
local cf = Character:GetPivot()
if not lastCF then
lastCF = cf
return
end
local position, lastPosition = cf.Position, lastCF.Position
local raycastResult = workspace:Raycast(lastPosition, position - lastPosition, raycastParams)
local hitPart = if raycastResult then raycastResult.Instance :: BasePart
else nil
if not raycastResult or hitPart.CanCollide ~= true then
lastCF = cf
return
end
Character:PivotTo(lastCF)
end)
end
if LocalPlayer.Character then
onCharacterAdded()
end
LocalPlayer.CharacterAdded:Connect(onCharacterAdded)
LocalPlayer.CharacterRemoving:Connect(onCharacterRemoved)
this doesnt take into account for pretty much anything, like teleporting, id really just recommend using this as a reference for seamlessly preventing players to dance clip or something
I’m trying to prevent no clip while still allowing dance clipping and other glitches
if youre allowing any kind of clipping then why bother adding noclip prevention
however, you could just disable this when the player starts emoting, im pretty sure the “PlayEmote” or whatever RemoteFunction in the Animate script for players fires whenever they dance, or you could check the player’s playing AnimationTracks and disable the noclip prevention whenever an emote is found
so theres a game where like no clip scripts dont work in them at all but still manages to allow dance clipping and other glitches but im creating an obeying game, so im curious how to do that
like i said before, you could utilize this to allow emote clipping
https://create.roblox.com/docs/reference/engine/classes/Animator#GetPlayingAnimationTracks
i wouldnt really recommend adding noclip prevention if you want to allow emote clipping and stuff, its just a waste of resources, even if its small
not to mention, this is only to fight back a little bit of people, i dont think that many people exploit, even when children exploiting, they will just fly rather than noclip
also, do you know how to fix the roblox studio bug where the camera turns to fast
i dont think this has ever happened to me, have you checked your settings in play test and made sure your mouse sensitivity is normal (for some reason this affects studio camera)? have you checked studio settings and anything that affects mouse speed and what not?