How to kick players out of a player-owned plot

Hi,

I made a door that can be claimed along with a plot. How do I add a UI button that prevents other players from walking on a plot that is owned. This is something the owner of the plot can toggle through an ui button.

How do I do this?

2 Likes

Iā€™m bumping the post, any help is very much appreciated :slight_smile:

Firstly, maybe instead of parenting the plot you can add a string value into the tycoon and set the value to the players name.

Ex:

local plot = script.Parent
local owner = plot.CurrentOwner --A string/Object Value

plot.Door.Touched:Connect(function()
   --Debounces and other code
   owner.Value = plr.Name --get the player from the character, this will only work if this value is a string value. If the value isnt a string value and its an object value you can use the players character.


end)

Then, you can use Reigon3 or Magnitude to check if any player is near the plot of land. If that player is near the land (or directly on it), and they are not the owner of said land, you can move their position out of the plots parameter.

If you need further explanation, feel free to let me know.

Hope this helps!

You can use collision groups to prevent other players from going onto the plot.

1 Like