How do I fix remote function not fireringto local script

Hello, I have this problem where when I fire a client remote event the local script doesnt react and it doesnt even print the thing. Does anyone know why this is happening?
Here is my code:

local coin = script.Parent
local storage = game:GetService("ReplicatedStorage")
debounce = false

coin.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	
	if debounce == false then
	if humanoid then
debounce = true
		local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
		player.leaderstats.Coins.Value += 1
		
		storage.CoinRemoteEvent:FireClient(player)
		
		wait(120)
		
		debounce = false
	end
    end
end)

and this is the local script:

local coin = script.Parent
local storage = game:GetService("ReplicatedStorage")

storage.CoinRemoteEvent.OnClientEvent:Connect(function()
	print("works")
	coin.CanTouch = false
	for i = 0, 1, 0.01 do
		coin.Transparency = i
		wait(0.01)
	end
	wait(118)
	for i = 1, 0, -0.01 do
		coin.Transparency = i
		wait(0.01)
	end
	coin.CanTouch = true
	
end)

any help is appreciated!

It looks like the local script is somewhere in the workspace. Local scripts won’t run in the workspace unless they’re parented to a character, so you could try moving this local script into StarterPlayerScripts or StarterCharacterScripts.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.