How could I make Owner.Value not work for other players when interact?

Owner value already has player username when placing the tool, however I still want it to be reomved only by a specific player. How could I make that?

pickup_prompt.Triggered:Connect(function(player)
		if mortar.Owner.Value == player.Name then
		find_mortar_tool(game.ServerStorage):Clone().Parent = player.Backpack
			mortar:Destroy()
			else
		end
	end)

What is inside mortar.Owner.Value

It uses mortar.Owner.Value = player.Name when mounting it.

I mean what is inside the Value, the UserId, the Name, etc

It is using the player username.

pickup_prompt.Triggered:Connect(function(player)
print(1)
		if mortar.Owner.Value == player.Name then
print(2)
		find_mortar_tool(game.ServerStorage):Clone().Parent = player.Backpack
print(3)
			mortar:Destroy()
			else
		end
	end)

Replcae this with your script, and tell me where it stops printing in the Output.

Rather be it current player username or random letter as a input of owner.value, it’s doing everything till the deleting part, so 3rd one.

What is this: find_mortar_tool(game.ServerStorage), if this is right then i never saw that form of script. And better use UserId than the Name of the Player:

Try this:

pickup_prompt.Triggered:Connect(function(player)
		if mortar.Owner.Value == player.UserId then
		game.ServerStorage."Your Tool":Clone().Parent = player.Backpack
			mortar:Destroy()
			else
		end
	end)

Also replace the Name with UserId in the script where u inserted the Name of the Player to the mortar Owner.

If using player.UserID it just doesn’t work.

Because the first time when you set the Name you need to change it to UserId, how i said it in my post about 13 min ago

You could do it so when the owner joins a game a value is stored in them and when the prompt is triggered it checks if the player has the value

game.Players.PlayerAdded:Connect(function(player)
if player.Name == owner name then
local folder = instance.new(“folder”)
folder.name = “owner”
folder.Parent = player

end
end)


You could then detect if the player has the folder when it’s triggered

This could also be used to detect if it’s the owner for other items 

Sorry I wrote this on phone
@Slava_X220

1 Like

That’s what I’ve done. First of all it didn’t go any further than checking for UserId. When I change StringValue on NumberValue same problem appeared.

Pretty much what I said but okay.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.