I have been basically been making a game and I have this button thats only supposed to run if you own the property and if the person who touched the button owns the property. This is to keep others from pressing your button.
Heres the line of code that doesnt work.
local NotActivated = true Button.Touched:Connect(function(TouchedPlayer) if NotActivated == true then if script.Parent.Parent.OwnerDoor.Owner.Value == TouchedPlayer.Parent then
Keep in mind this is just a small portion of the code, its mainly the important stuff.
The last line doesnt work and I dont know why. It seems fine to me.
Thank you for your time :) If you have question ask them.
You are referring to an instance as if it were a value, take a look at this line:
if script.Parent.Parent.OwnerDoor.Owner.Value == TouchedPlayer.Parent
See the mistake? You're telling the game to check if the value of the instace "Owner" is another instance. I don't know what your structure is, but if you have something inside the player who touches it, you'll do something like
if script.Parent.Parent.OwnerDoor.Owner.Value == TouchedPlayer.Parent.*Item*.*OptionalValue* then ...
So for example, say the value of "Owner" is a string, which is "OwnerOfThis", you'd put a string value inside the player that also has a string value that is "OwnerOfThis" and you'll check for that value with the code above, so it'll be something like:
if script.Parent.Parent.OwnerDoor.Owner.Value == TouchedPlayer.Parent.Verifier.Value then ...
Let me know if this helps, keep me updated.