Hi, im currently making a tycoon dropper system, where if you touch the spawner, it spawns a part, when the part touches the end, it gets destroyed and gives the player money.
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Money"
money.Value = 50
money.Parent = leaderstats
--
local give = game.Workspace.en
local dp = game.Workspace.drop
local debounce = false
dp.Touched:Connect(function(Drop)
if not debounce then
debounce = true
local mon = Instance.new("Part")
mon.Position = Vector3.new(-43.906, 5.069, -10.324)
mon.Parent = game.Workspace
mon.Name = "Mdrop"
mon.Anchored = false
wait(2)
debounce = false
end
end)
give.Touched:Connect(function(giveplayermoney)
if giveplayermoney.Parent:IsA("Part") and giveplayermoney.Parent.Name == "Mdrop" then
money.Value = (money.Value + 1)
giveplayermoney.Parent:Destroy()
end
end)
end)
This is a normal script, in serverscriptservice, my problem is that whenever i test the game, the part is being destroyed OR giving me money, does anyone know how to fix this?