How can i make a coin counter

nope still does not work nothing printed

want a copy of the game? (its so basic idc about uploading it)

That would be helpful as even Iā€™m confused now

coin test.rbxl (75.9 KB) there

Okay your issue was a simple one, in your event that increases the coins, you were immediately getting whatever was inside of the Value property of the coin, you have to reference the Coins IntValue and update the Value yourself, basically your scritp that handles awarding should be this

local player = game:GetService("Players")
local coin = script.Parent -- Path to coin
local Coins = game.Workspace.Coins
local used = false

function giveCoin(part)
	if part.Parent:FindFirstChild("Humanoid") == nil or used == true then
		return
	end
	used = true
	local player = player:GetPlayerFromCharacter(part.Parent)
	Coins.Value += 1
	print(Coins)
	coin.coincollect:Destroy()
	coin:Destroy()
	print("it should have worked")
end

coin.Touched:Connect(giveCoin)

Also you really need to fix the script around since thereā€™s some confusing code/unneeded code

thanks it works perfectly ill mark the first message you sent as the answer for if anyone else is confused

1 Like

Anytime! If you have anymore isuses donā€™t be afraid to make another post!

Also, I recommend you fix up the general organization of the coins since youā€™d have 2 scripts for each coin, itā€™s better to have it set up so a single script handles the touched events

FYI the newVal parameter is the name of the property that changed not the new value.

Doesnā€™t apply for BaseValues, the Changed event for Basevalues, such as IntValues, returns the new value, what you mentioned is for other instances