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 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.
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
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.