--local script
par = game.Workspace.RubyGold.Collect
function onClick()
if script.Parent.Parent.Parent.PlayerProfile.TreasuresCollected.GoldRubyC.Value == 0 then
game.ReplicatedStorage.GoldRubyRe:FireServer()
game.Workspace.RubyGold.Collect.ClickDetector.Archivable = false
local storage = game:GetService("ReplicatedStorage")
local Treasure = storage["RubyGoldR"]:clone()
Treasure.Parent = game.Workspace
game.Workspace.RubyGoldR:MoveTo(Vector3.new(4.602, 1.546, 164.958))
end
end
par:findFirstChild("ClickDetector").MouseClick:connect(onClick)
.
--server script
game.ReplicatedStorage.GoldRubyRe.OnServerEvent:Connect(function(plr)
local myName = "CollectionValue"
game.ReplicatedStorage.GoldRubyRe.OnServerEvent:Connect(function(plr)
local CollectionValue = plr.PlayerProfile:FindFirstChild(myName)
CollectionValue.Value = CollectionValue.Value + 5
end)
end)
