IntValue triples in game

hi, i have a system where a proximity prompt is triggered which fires a remote event which increases a value. in roblox studio, it works correctly and adds 1 however, in game it breaks and adds 3 to the value (increases depending on player count)
server script

script.Parent.Parent["Mystery Egg Mesh"].ProximityPrompt.Triggered:Connect(function(player)
	script.Parent.Parent.Name = "desEgg"
	game.ReplicatedStorage.giveEgg:FireClient(player)
	game.ReplicatedStorage.desEgg:FireClient(player)

	script.Parent.RainbowParticles.Enabled = true
	task.wait(0.3)
	script.Parent.RainbowParticles.Enabled = false
	script.Parent.Name = "egg"

end)

local script

game.ReplicatedStorage.giveEgg.OnClientEvent:Connect(function(player)
	game.SoundService.Ding:Play()
	game.ReplicatedStorage.giveEgg2:FireServer(player)

end)
game.ReplicatedStorage.desEgg.OnClientEvent:Connect(function(player, Egg)
	task.wait(0.8)
	local des = game.Workspace.EasterEvent:WaitForChild("desEgg"):Destroy()
	
end)

server script

	local data = DataManager:GetData(player)
game.ReplicatedStorage.giveEgg2.OnServerEvent:Connect(function(player, egg)
	local egg = player.FoundEggs.Eggs.Value
	player.FoundEggs.Eggs.Value += 1
	game.ReplicatedStorage.eggupdate:FireClient(player)

	if player.FoundEggs.Eggs.Value >= 12 then
		if complete.Value == 0 then
		complete.Value = 1
		print("Done!")
			data.Tix += 250
		--MarketplaceService:PromptPurchase(player, 00000000) -- put free ugc itemid in here
		end	
		end
end)
end)
1 Like

Okay I’m not going to go over how to make this better right now but how to fix it.

You don’t need to add a Player argument when you’re using FireServer, the argument is provided on the server automatically.

Is the RemoteEvent already contained within the PlayerAdded event? If not, you should move it in there so you can do a check like this:

ExampleRemote.OnServerEvent:Connect(function(plr)
if Player.Name == plr.Name then
1 Like

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