Weird Bug with a pop up script

I have a pop up script that when a remote is fired it displays a text.

This is the part of the script where the bug is at :

ReplicatedStorage.Remotes.statUpRemote.OnClientEvent:Connect(function(amount : string, statName : string)
	if not amount or not statName then return end
	
	print(amount, statName) -- Will print 2, "Wins"
	
	local Template = script.Template:Clone()
	Template.Size = UDim2.new(0.01, 0, 0.01, 0)
	Template.Position = randomPosUI(script.Parent, Template)
	Template.Parent = script.Parent
	Template.Text = string.format("+%i %s", tonumber(amount), tostring(statName)) -- here

end)
local reward = Requirements[tostring(currentPlatform)].Reward * 2
print(reward)
Profiles.PlusStat(player, "Wins", reward) 
ReplicatedStorage.Remotes.statUpRemote:FireClient(player, tostring(reward), "Wins")

The template text is not set the the amount argument but to how much Wins the player has, which is not supposed to happen since I’m not referring the amount of wins.

This doesnt happen when I’m firing the remote event from the command bar, this is very weird.

image

image
image

2 Likes

I don’t get what the problem is, do you want it to print “4 Wins”? Also, just wondering, but why are you sending reward as a string, instead of an integer?

It’s something with the string.format()?

Something to do with the template being cloned? What exactly is the template? Does the remote get fired once or multiple times?

I was honestly thinking the same thing…

I don’t know what is broken to be honest with you, is the 4 wrong or the 2?

1 Like

You need to be clearer with your forum posts so we can help you as much as possible.

What value is incorrect? 4 or 2?
What is the template?

Another thing to mention, protect your remote event. An exploiter can specify what wins to display and it’ll do it accordingly.

Specify the wins from the server?

I want it to print 2 instead of 4,
2 is the amount argument
4 is the amount of wins (that i never refer)

I tried removing it before it make a difference

Template is a text label, the incorrect value is 4

An exploiter cant :FireClient()

I would use a breakpoint and add a watch to the amount variable. Something funky is happening with the print.format.

I’ve tried removing the string and just making one single argument called text and it still prints the wins amount instead of the text argument

Is the 4 the default template text? Where is it getting 4 from?

Make the actual text just "", an empty string. If it’s still 4 then something’s changing it to that number.

The template text is “+2 wins”, the 4 is the amount of wins the player has for some reason…

Still… [Character limit asqdsq]

I’ve tried debugging and added this script :

game.Players.PlayerAdded:Connect(function(plr)
	while task.wait(1) do
		game.ReplicatedStorage.Remotes.statUpRemote:FireClient(plr, 10, "Test")
	end
end)

it shows 10 and its perfectly fine however when it’s in the other script it does that bug…

I’ve managed to find the solution

It was because of the text label template for some reason I still have to figure out why.