FilterEnabled and parts

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.

You shouldn’t do this .touched doesn’t always return a player

And firing the client every time it is touched will just crash the game

See: FireClient and Touched. Touched passes a part. Aim to use GetPlayerFromCharacter from the parent model of the part. You can use either Parent or FindFirstAncestorOfClass(“Model”) for this.

@uugnut6 Would be more helpful if you replied with more information, like what it does fire with. Also just to be clear: firing the client in Touched events will not crash the game. Please get the right information if you’re looking to offer help.

(Also please try to post minimally! This isn’t a chat server, it’s a forum, multiple posts is sort of spammy - you can edit new content in.).

So everything seemed correct and it didn’t even give me an error but it still isn’t letting the “player” to go through the door.

Server Script inside part

local part = script.Parent
local debounce = false

part.Touched:Connect(function(touched)
	local Player = game.Players:GetPlayerFromCharacter(touched.Parent)
	if not Player then return end
	if debounce == false then
		game.ReplicatedStorage.DoorAccess:FireClient(Player)
		wait(10)
		debounce = true
	end
end)

Local Script inside StarterPlayerScripts

local Player = game.Players.LocalPlayer
local debounce = false
local part = game.Workspace["Leaderstat Door for tutorial"]
local character = game.Players.LocalPlayer.Character

game.ReplicatedStorage.DoorAccess.OnClientEvent:Connect(function(Player)
	if character and part:IsDescendantOf(character) then
		if Player.leaderstats.Money.Value >= 1000 then
			if debounce == false then
				debounce = true
				print(Player.DisplayName.." has went on the other side of the door!")
				part.Transparency = 0.5
				part.CanCollide = false
				wait(10)
				debounce = false
			end
		else
			print(Player.DisplayName.." doesn't have enough money!")
		end
	end
end)

Consider doing some debugging. You could throw some quick prints throughout the code to check what is and isn’t running. If your script isn’t producing errors but it doesn’t do what you expect it to do then it could be a problem of not having the right conditions met. For example, you’re checking if the leaderstat door is a descendant of the character yet it’s in the workspace so that obviously wouldn’t pass.