I'm currently making a collection system so that when an object is mined by a player, only the player will see and be able to interact with the drops from the object.
The problem is that, the drops do appear, but the collection part by touching it does not work.
This is the local player script
local replicated_storage = game:GetService("ReplicatedStorage")
local remote = replicated_storage:WaitForChild("Remotes"):WaitForChild("OnBroken")
remote.OnClientEvent:Connect(function(itemType, number, node)
if itemType == "Stone" then
for i = 1, number, 1 do
local item = replicated_storage.Ore1:Clone()
item.Anchored = false
item.Parent = game.Workspace
item.CFrame = node.CFrame * CFrame.new(math.random(1,2), 0, math.random(1,2))
end
end
end)
and this is the script within the ore inside the replicatedstorage.
print('working')
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player game.Players:GetPlayerFromCharacter(hit.Parent)
local stat = player.leaderstats.Cash
stat.Value = stat.Value + 30
end
end)
There are no error results or prints from the script within the ore.
i've tried disabling and reenabling the script

1 comment
So you're creating a part locally, then checking for the touch on the server? Read what i've just said and i think you'll understand the issue.