I have enough coins but it keeps saying "Not Enough Coins." Thanks

`local NPC = game.ReplicatedStorage.NPC1 local NpcCost = game.ReplicatedFirst.DataValue.NPC1.Cost.Value local Spawner = game.Workspace.NPC1Spawn local CoinValue = script.Parent.Parent.Parent.Parent.Parent.Data.PlayerData.CoinValue.Value

function LeftClick()

if CoinValue >= NpcCost then
	print("Bought")
	local NpcClone = NPC:Clone()
	NpcClone.Torso.CFrame = Spawner.CFrame
	NpcClone.Parent = workspace	
		else
	print("Not Enough Coins")	
end

end

script.Parent.MouseButton1Click:Connect(LeftClick) `

3 comments

0

Sorry I messed up the formatting.

0

i could use some more information to help u, is it inside of a local script or a server script?

0

also where is all the other object located inside of the game? and where is the script?