So i want players to be able to claim a brick once when they click it. Currently instead of cloning a string value to the player that clicked the brick it gives clones to all players
--script
local ReplicatedStorage = game.ReplicatedStorage
local event = ReplicatedStorage.RemotEvent
bricks = game.Workspace.bricks
event.OnServerEvent:Connect(function(plr)
for i,clickedbrick in pairs(bricks:GetChildren()) do
for i,detector in pairs(clickedbrick:GetChildren()) do
detector.MouseClick:Connect(function()
if plr.questFolder:FindFirstChild(clickedbrick.Name) then
print("Already claimed")
else
local cb = Instance.new("StringValue")
cb.Parent = plr.questFolder
cb.Value = clickedbrick.Name
cb.Name = clickedbrick.Name
end
end)
end
end
end)
--localscript
local ReplicatedStorage = game.ReplicatedStorage
local event = ReplicatedStorage.RemotEvent
game.Workspace.Baseplate.ClickDetector.MouseClick:Connect(function()
event:FireServer()
end)
