So when I added values on a local script, it worked correctly. But when I used parameters and remote events, it changed the value to player and I don't know why. Help please. Local Script:
local updateDogecoinEvent = game:GetService("ReplicatedStorage"):WaitForChild("UpdateDogecoin") local setDogecoinEvent = game:GetService("ReplicatedStorage"):WaitForChild("SetDogecoin") updateDogecoinEvent.OnClientEvent:Connect(function() local player = game.Players.LocalPlayer local dogecoin1 = player.PlayerScripts.changeDogeAmount.Doges.Value * 2 local dogecoin2 = player.PlayerScripts.changeDogeAmount.NoobDoges.Value * 10 local dogecoin = dogecoin1 + dogecoin2 setDogecoinEvent:FireServer(dogecoin) print(dogecoin) player.PlayerScripts.changeDogeAmount.NoobDoges.Value = 0 player.PlayerScripts.changeDogeAmount.Doges.Value = 0 end)
Server Script:
debounce = true script.Parent.selll.Touched:Connect(function(leg) if debounce == true then debounce = false if game.Players:GetPlayerFromCharacter(leg.Parent) then print("doge sell") local player = game.Players:GetPlayerFromCharacter(leg.Parent) print(player) local updateDogecoinEvent = game:GetService("ReplicatedStorage"):WaitForChild("UpdateDogecoin") local setDogecoinEvent = game:GetService("ReplicatedStorage"):WaitForChild("SetDogecoin") local dogecoinGuiEvent = game:GetService("ReplicatedStorage"):WaitForChild("dogecoingui") updateDogecoinEvent:FireClient(player) setDogecoinEvent.OnServerEvent:Connect(function(dogecoin) print(dogecoin) player.leaderstats.Dogecoin.Value = dogecoin script.Sound.Playing = true dogecoinGuiEvent:FireClient(player) end) end wait() debounce = true end end)