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!