Owner door not working

I’m currently making a capture the flag type of system in my game and I want players who capture certain flags to gain specific advantages. I am using a giver in a room for this and I want to use an owner door (much like what is in tycoons) to keep players who do not have the flag from getting the item in it, however when I set myself as the owner of the flag in the server the door still kills me.

Side note, I am very very new to scripting

local Door = script.Parent
local Owner = Door.Parent.Owner
local Player = game:GetService("Players")

function onTouched(Hit)
	local Character = Hit.Parent
	local Player = game.Players:GetPlayerFromCharacter(Character)
	if Player and Player.Name ~= Owner.Value then
		Character:BreakJoints()
	end
end

Door.Touched:connect(onTouched)
1 Like

Either it’s case-sensitive or something else. What exactly did you put on Owner.Value when you tested the door on yourself?

I put my player name into the Owner value

If you are changing your Owner Value on the client, it will not work because it won’t be replicated back to the server, instead, while testing the game, click up at the play button and switch to “Server” to test it out.

This is because of filtering enabled.

(If this is done through a LocalScript, instead just do a FireServer using events)

I’m changing the owner value on the server, but I appreciate the advice anyhow. If not for a youtube video I watched earlier today I wouldn’t have known.

1 Like

The only thing I did to your script in Studio was make my own StringValue named “Owner” and it worked fine (I changed the ~= to == and I died). Where is this script, in a part? (It’s also firing many many times)

The highlighted part is the script. The owner also has a boolvalue attached to it that is just dependent on the string value, but this is because of the nature of the claim script.

Is the Owner value your username exactly (with correct capitalization/no typos)?

The value is being changed to the players name I think so it should exactly copy there name

1 Like

I feel like such an idiot lmao

I’ve been using a capital L instead of lowercase (how I made my name what it is). Sorry for wasting all of yall’s time but I appreciate all of the support and feedback! Everything is working perfectly now

1 Like

If this doesn’t work make sure accessories are not touching the part since their parent is not the character but an accessory instance.