Sign Editable by Everyone

Hello, this script manages the owner of a sign however when the sign is claimed anyone can edit the text on it and the edit proximity prompt shows up for everyone. Any help is appreciated.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local EditEvent = ReplicatedStorage.Events:FindFirstChild("EditEvent")

local Sign = script.Parent.Parent

local ClaimPrompt = Sign.Structure.Prompt:FindFirstChild("Claim")
local EditPrompt = Sign.Structure.Prompt:FindFirstChild("Edit")

local OwnerText = Sign.Structure.Signs.OwnerSign.SurfaceGui:FindFirstChild("Owner")
local OwnerValue = Sign.Values:FindFirstChild("Owner")

ClaimPrompt.Triggered:Connect(function(Player)
	if Player.Character:FindFirstChild("Humanoid") and OwnerValue.Value == nil then
		ClaimPrompt.Enabled = false
		OwnerValue.Value = Player
		OwnerText.Text = tostring(OwnerValue.Value).."'s Sign!"
		EditPrompt.Enabled = true
	end
end)

EditPrompt.Triggered:Connect(function(Player)
	if Player.Character:FindFirstChild("Humanoid") and OwnerValue.Value ~= Player.Name then
		EditPrompt.Enabled = false
		EditEvent:FireClient(Player)
	end
end)

Try changing “Owner.Value ~= Player.Name” to “Owner.Value == Player.Name”. I think the game is allowing non-owners to edit because of this.

Alright I’ll test this new script.

Alright so now the edit ui doesn’t show up with this script.

Ah, I took a closer look at your script and you’re setting owner.Value to the player itself. Change it so it sets it to the player’s name instead.

Would it be OwnerValue.Value = Player.Name?

Alright so I did the edit I suggested and this showed in the output. Was it correct or was a different change supposed to be made?

image

Is it an ObjectValue or StringValue?

The script uses an ObjectValue.

Why are you checking if OwnerValue.Value is different than Player.Name in line 24 if it is a ObjectValue. You should change to

OwnerValue.Value ~= Player

What @vParkuu said. Your script should look like this to fit ObjectValues.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local EditEvent = ReplicatedStorage.Events:FindFirstChild("EditEvent")

local Sign = script.Parent.Parent

local ClaimPrompt = Sign.Structure.Prompt:FindFirstChild("Claim")
local EditPrompt = Sign.Structure.Prompt:FindFirstChild("Edit")

local OwnerText = Sign.Structure.Signs.OwnerSign.SurfaceGui:FindFirstChild("Owner")
local OwnerValue = Sign.Values:FindFirstChild("Owner")

ClaimPrompt.Triggered:Connect(function(Player)
	if Player.Character:FindFirstChild("Humanoid") and OwnerValue.Value == nil then
		ClaimPrompt.Enabled = false
		OwnerValue.Value = Player
		OwnerText.Text = tostring(OwnerValue.Value.Name).."'s Sign!"
		EditPrompt.Enabled = true
	end
end)

EditPrompt.Triggered:Connect(function(Player)
	if Player.Character:FindFirstChild("Humanoid") and OwnerValue.Value ~= Player then
		EditPrompt.Enabled = false
		EditEvent:FireClient(Player)
	end
end)

Okay so with this new script the same issue of the edit ui not showing up has remained.

The ui still won’t show up even with this change.

Even if you changed this part to OwnerValue.Value == Player?

1 Like

Alright this new script works thanks.