FilterEnabled and parts

if the player is in a collision group and the player is added to another, it will just be removed from it’s previous collision group. It should be fine to do this with multiple parts

Doesn’t seem to be working.

My code:

local PhysicsService = game:GetService("PhysicsService")

local wall = "Door"
local playerWhitelist = "Whitelist"

PhysicsService:CreateCollisionGroup(wall)
PhysicsService:CreateCollisionGroup(playerWhitelist)

PhysicsService:CollisionGroupSetCollidable(wall,playerWhitelist,false)

PhysicsService:SetPartCollisionGroup(script.Parent,wall)

script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if not player then return end
	if player and player.leaderstats.Money.Value >= 1000 then
		for _,p in pairs(hit.Parent:GetChildren()) do
			if p:IsA("Part") then
				p:SetPartCollisionGroup(p,player)
			end
		end
		player.leaderstats.Money.Value -= 1000
		print("Successful")
	end
end)

A little bit revised to fit the game.

First, alvin blox’s video I have already seen VIA Filter Enabled and it was depreciated.

Second, thanks for the link. I got something to flag for moderation.

??? wdym? I pasted youtube.

Also it’s great that you have seen his video

Also try this this video

link: Roblox Filtering Enabled Tutorial - RemoteEvents (Part 1) - YouTube

can you show us the output, does it print successful

Alvin blox’s videos are nice but Filter Enabled is depreciated. Also, that doesn’t lead to YouTube as when I hover on it, bottom right tells me a link that doesn’t link to YouTube bro.

It prints nothing. I saw in your script that it should print “Successful” but it didn’t.

My bad,

My pasteboard is messed up from my pc being hacked.

filteringenabled is forced into all games you cant disable it

Yes, Roblox made it default and I think workspace.FilterEnabled still works as well as said in the post below:

Roblox Filter Enabled Topic

I wrote a tutorial on how to deal with Touched events from the client. The idea is that you need to confirm if the Player who triggered the Touched event is the same as the LocalPlayer.

Do not waste your time trying to prevent exploiters cheat your door system. They can simply delete the door or even noclip through it.

So if the player touches the part, CanCollide can be turned off and transparency can be 0.5 for example, but for others, it would be the same? Also, nice tutorial.

exactly why there should be a second part that kills you using the server

I’m getting an error with the script:

Workspace.Leaderstat Door for tutorial.Script:5: attempt to index nil with 'Character'

Script:

local LocalPlayer = game:GetService("Players").LocalPlayer
local part = script.Parent
local debounce = false

part.Touched:Connect(function (part)
	if LocalPlayer.Character and part:IsDescendantOf(LocalPlayer.Character) then
		if LocalPlayer.leaderstats.Money.Value >= 1000 then
			if debounce == false then
				print(LocalPlayer.DisplayName.." has went on the other side of the door!")
				part.Transparency = 0.5
				part.CanCollide = false
			end
		else
			print(LocalPlayer.DisplayName.." doesn't have enough money!")
		end
	end
end)

Script located inside the part

1 Like

LocalPlayer is nil to server scripts. I was under the assumption that you were using a LocalScript. In the case of a server script you are unable to make touches local for the player. As well, upon checking your code and seeing that a certain stat is required to access the door, both the server and the client need to be involved. You will need a remote to handle this.

Ideally you can check if the player who touches the part has enough money and if they do, fire a remote to the client to destroy the door on their end.

1 Like

Would a local script work inside StarterPlayerScripts to be able to destroy the part of the players end?

Sure. I like to keep my client-side code in StarterPlayerScripts as much as possible.

FireClient: player argument must be a Player object

part.Touched:Connect(function(Player)
	game.ReplicatedStorage.DoorAccess:FireClient(Player)
end)

By any chance, do you know what I would put after “FireClient”. I tried player but apparently, Roblox doesn’t like that lmao.