Need help with making an door that detects if player have much value in the specific intvalue and if they have enough it will open

You overlooked one thing though
A player can open the door for another player by constantly walking inside it, even if the other player lacks the requirements to enter the door.
What would happen is the door would constantly flicker between opening and closing, which may allow the other player to pass.

hey there again, I recorded the video of whole thing, so basically clicking the social credit + button until it reaches 4 supposed to make the door open, but it still didnā€™t open for me, plus I even tried that again by deleting the .Name, but thing didnā€™t come in good.
the video of that footage I recorded

I greatly appreciate your help. -mari

I edited my reply above.
Have you tested my localscript?

I just realized maybe the .Touched event doesnā€™t return the model or something idk

So like, @SuplierZWTF 's local script is probably the best choice in this case
and make sure it is placed in the correct location


the image of me gone through the social credit door and the hostile npc in game canā€™t entering it

thank you so much, the whole thing works as it supposed to after I put it on starterplayerscripts, now Iā€™m eternally pleased, I can now rest now, tysm again. :hugs:

-mari

Well put the localscript in StarterPlayerScript. For the script you can try this:

local Player = game.Players.LocalPlayer
local SocialCredit = Player:WaitForChild("SocialCredit")

local function onValueChange()
	if SocialCredit.Value >= 3 then
		wait(0.1)
		workspace.SocialCreditDoor1.CanCollide = false
		print("the social credit door 1 has been opened")
	else
		workspace.SocialCreditDoor1.CanCollide = true
		print("the social credit door 1 has been closed")
	end
end


SocialCredit.Changed:Connect(onValueChange)

Iā€™m sorry to say it but youā€™re bit late, SuplierZWTF was able to solve the problem for me before you.
anyway, Iā€™m hoping this topic appears in the google search results so more peoples can be helped by this conversation, peace out.

1 Like

Sorry to reply too late, but actually if you used my code I sent above, it was totally a solution and I should have been marked as a solution. But I just want to tell that LocalScripts arenā€™t too convienient in this type of situation you faced. Using a normal script as I suggested above is better. Just remember that for future. Peace!

I would very much disagree with this, as although a client script can be easily changed as its is client sided, any serverscript in this situation (without some complicated teleportation or client-server stuff) can be easily exploited to allow other players into the door by simply standing next to it and running into it continuosly (which would repeatedly trigger the .touched event and therefore repeatedly open the door right after it closes)

He didnā€™t asked for any opening or closing of a door, he asked for a script that will allow players to bypass something after particular value. I donā€™t completely understand whatā€™s your point. And client-sided is more exploitable, afterall you need to come to normal script only to make an anti-cheat system.

When the .Touched event fires, it would only allow a player to bypass when they reached a certain value, so I see no chance to be exploited.

That does make sense, however, as the original post had said to want to use a client script, it can be implied that they only want it to open for the person who have reached the correct value.

It is true that the code cannot be exploited until a certain value is reached, however, once the value is reached for a single player, everyone now has access to the area. The exploit for the client code does not require there to be a client code at all, as it is as simple as turning the door to cancollide false on the client to get through it, which works no matter if you use a serverscript or a client script.

It seems that in this case, client script is actually less exploitable, as while the server script introduces an easy exploit, the only exploit available for the client script is something that can be done with the server script as well (which is, to make the door cancollide false)

note that as it is a serverscript, the door allows ALL players to bypass when the .Touched event fires, therefore allowing a single player to let the entire server through the door, when that is obviously not the intended situation. This can be patched by teleporting the player instead, but that is irrelevant to this as it is a door and not a teleporter

Oh, I thought he wanted to teleport a player and not ā€œpassā€ a player. Sorry, my bad. In that case, that makes sense to use LocalScripts.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.