T-Shirt client-sided door

I’m not an advanced scripter, so does anyone know how to make a client sided script which makes the part go non collision if they own a certain t-shirt?

I’ve used many scripts but the issue is the fact other users can also walk through the door if they’re going in the same time. I really need help and a solution for this, as I am trying to do a queue for my Stealth recreation from Thorpe Park.

1 Like

Use physicservice and marketplaceservice, but make it serverside, rule n°1: never trust the client.

I feel in this scenario is there any reason to complicate it by not trusting the client? in the end the exploiter might as well just delete said part / nocollide it themselves.

However yeah never trust the client.

1 Like

You could use a touched event in a localscript and check the players t-shirt ID. If it’s the right ID open the door for them (locally). Additionally you could add a hit box on the server inside the area that checks their shirt and kicks or teleports them if they don’t have the shirt.

I’m more of a functions person and I am into cframing, so I am not the best at that kind of scripting. I will try my best though :confused:

Alright thanks, I will look into this!

1 Like

The main thing I want to accomplish is to let ONLY the user who owns the t-shirt through, not anyone who ever tries to enter at the same time. (As the wall will be non-collision)

The only way to do that is to open it locally for them with a localscript. It will be closed for all other players.

Yes you can use MarketplaceService on the client, however you could just simply do checks server-sided, and then fire a remote event if the player has the item. However I don’t see any issue with doing something like this client-sided as exploiters can just set the door/part collision for their client. Be that as it may, you may want to do the first statement I said as it allows you to to use a region based system and verify if they have the shirt if they dont then teleport them outside or whatever punishment you find feasible.

As mentioned by @Aethersthetix use MarketPlaceService or more specifically PlayerOwnsAsset. Normally I agree never trust the client. But I feel like in this scenario there is no real reason to make it server sided? To make it simple I would ask when the player joins if they own the asset and then just open the door if that is true. Code wise something like this.

local MarketPlaceService = game:GetService("MarketplaceService")

local CanAccess = MarketPlaceService:PlayerOwnsAsset(game.Players.LocalPlayer, 2960067065)

Part.Touched:Connct(function(Hit)
	local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
	if Player and Player == game.Players.LocalPlayer then
		if CanAccess then
			Part.CanCollide = false
			Part.Transparency = 1
		end
	end
end)
1 Like

Thank you so much, this is really going to help! :slight_smile: