[Help Needed] Lock Player Scripts

I’m working on making an F3X sandbox-type game. I do not know how to script so I had to do some research to get these scripts listed below, I want it so players cannot move/delete/edit other players which would be fixed by locking all the players who join. These are 2 separate “Scripts” that are in StarterPlayer > StarterCharacterScripts.

For some reason this isn’t working, I am not sure if it’s because of the F3X tool itself or maybe the script isn’t written properly. I am not sure as I am not a scripter and know nothing about scripting.

R6 Lock Script
script.Parent.Head.Locked = true
script.Parent.Torso.Locked = true
script.Parent.HumanoidRootPart.Locked = true
script.Parent["Left Arm"].Locked = true
script.Parent["Right Arm"].Locked = true
script.Parent["Left Leg"].Locked = true
script.Parent["Right Leg"].Locked = true
R15 Lock Script

script.Parent.HumanoidRootPart.Locked = true
script.Parent.Head.Locked = true
script.Parent.UpperTorso.Locked = true
script.Parent.LowerTorso.Locked = true
script.Parent.RightUpperLeg.Locked = true
script.Parent.RightUpperArm.Locked = true
script.Parent.RightLowerLeg.Locked = true
script.Parent.RightLowerArm.Locked = true
script.Parent.RightHand.Locked = true
script.Parent.RightFoot.Locked = true
script.Parent.LeftUpperLeg.Locked = true
script.Parent.LeftUpperArm.Locked = true
script.Parent.LeftLowerLeg.Locked = true
script.Parent.LeftLowerArm.Locked = true
script.Parent.LeftHand.Locked = true
script.Parent.LeftFoot.Locked = true

3 Likes

try putting them into starterplayerscripts.

1 Like

Still doesn’t work. Any other solutions?

1 Like
game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		for i,v in pairs(char:GetChildren())do
			if v:IsA('BasePart') or v:IsA('MeshPart') then
				v.Locked = true
			end
		end
	end)
end)

Put this into a script in ServerScriptService. It’ll work for both r6 and r15 or should at least.

1 Like

Was about to say put it in SSS

locked means that you cant click on it in studio.

how would someone delete a player?
is it a tool?

It’s meant for In-Game, not for studio.

Yeah I don’t think that’s how the locked property works

Still no success. I put it in a script inside ServerScriptService. Do I have to test it in a real game and not studio?

Are you sure that didnt work, because I just tested it and it worked fine? Did you try to put other things in the script with it? Just put that script in serverscriptservice. In a script > not a local script, not a module script > a regular script.

I put that into a normal script by itself.

https://gyazo.com/f923970578a2d69d6af6a4da451820c3

Well see the script works, the other scripts you have are interfering with it. Cuz I just check I know for a fact it works lmao. So you need to go through and look at that tool script because its the problem at hand. Something you could add to the script is checking to see if its a player instead of trying to lock everything inside the model itself.

Just checked, the player is getting locked its just the F3X tool can still select it for some reason… I also added a part to the baseplate thats locked and it can select the locked part

You have to go into the f3x code and find the select script and put an if statement thats asks if the parent of the part selected is a player.
I can’t really help anymore because I don’t know where the script is

How complicated would it be to change/add a script so you cant select any player?

I found a script in f3x called selected I would mess around with this function

function Selection.IsSelected(Item)
	-- Returns whether `Item` is selected or not


	return Selection.ItemIndex[Item];

end;

Use a remote event or function (remote function if you want some feedback) and some sanity checks so the player can be locked both in the server and the client without exploiters locking players for fun.

Also note that doing .Locked will not lock a player as said, this is for studio use so you cannot click on the object while editing. I’m not sure exactly what you mean by ‘locked’ so Ill take it as keeping the player in a position without moving.
However, the way I lock a player in position is by anchoring them. The only necessary thing to do is just to get the HumanoidRootPart and anchor it.

script.Parent.HumanoidRootPart.Anchored = true

I need all the players locked so people can select a player ingame and start dragging them around the baseplate or change colors, etc.

You should try messing around with the code provided by @GorillaWeb, not sure exactly how you would make it so you can drag someone’s character smoothly on a client.