Help with script working when not supposed to

Hey there,
I got this script here that is meant to give a player ownership of a booth if they don’t already own a booth and if the the booth they are trying to claim doesn’t already have an owner. However when I test it when 1 player claims ownership of a booth and then another player tries to claim the same board it lets him have ownership as well. I have no idea what’s wrong so any help is very apricated. :))
Script:

local button = script.Parent
local frame2 = script.Parent.Parent
local frame3 = script.Parent.Parent.Parent.Frame3
local plr = game.Players.LocalPlayer
local Values = plr:WaitForChild("Values")

button.MouseButton1Click:Connect(function()
	frame2.Visible = false
	if game.Workspace:FindFirstChild(Values.Booth.Value).Owned.Value == true then
		frame3.Visible = true
		wait(3)
		frame3.Visible = false
	else
		if Values.Own.Value == true then
			frame3.TextLabel.Text = "You already own a booth!"
		frame3.Visible = true
		else
	Values.Own.Value = true
	game.Workspace:FindFirstChild(Values.Booth.Value).Owned.Value = true
	game.Workspace:FindFirstChild(Values.Booth.Value).Owner.Value = plr.Name
		end
	 end
end)

Well, it doesn’t work client-sided only. It has to be server-sided also for multiplayer.
It think the fastest way to learn is by watching youtube tutorials on how they make game so that you may see how in real live working game works. Look at the ways how they use remote-event and remote-function.
:sweat_smile:

1 Like

How would I be able to get them to interact with the board then?