This is my script;

local Coin = script.Parent
local Owner = Coin.Parent:WaitForChild("Owner")
local MiningSet = Coin.Parent

game.Players.PlayerAdded:connect(function()
	wait(10)
	while true do
		wait(1)
		local CloneCoin = Coin:Clone()
		local Player = game.Players:FindFirstChild(Owner.Value)
		if not Player then
			MiningSet:Destroy()
		else
			wait(1)
			local CloneCoin = Coin:Clone()
			CloneCoin.Parent = game.Workspace
			CloneCoin.Anchored = false
			CloneCoin.CanCollide = true
			local CoinSpawn = game.Workspace:WaitForChild("MiningSet").Model.CoinSpawn
			CloneCoin.Position = Vector3.new(CloneCoin.Position)
			CloneCoin.Touched:connect(function(Hit)
				if Hit.Parent.Name == "Changer" then
					Player:WaitForChild("PlayerStatus").Coins.Value = Player:WaitForChild("PlayerStatus").Coins.Value + 1
				end
			end)
		end
	end
end)

There's no error but I can't figure out why my coin isn't spawning. This script is the coin that I want to be cloned. The coin is in a model. Can someone tell me how I would fix this or what I did wrong please?

4 comments

0

Why are you setting the CloneCoin's position to the position it is already in ?

0

I want the coin to be cloned at it's position

0

But then it will go through the other coin

0

It may just be FilteringEnabled as the server does not see the function of "game.Players.PlayerAdded:connect(function()" if FE is on