Got an error that I don't know about

Hey, so I got an error about this


I have no clue what this means, so I need help. Code is provided below

local IncreaseMultiplier = game.ReplicatedStorage.IncreaseMultiplier
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AnnouncementText = game.StarterGui.MainUI.AnnouncementText
local OldMulti = game.ServerStorage.StarterValues.PreviousMultiplier
local CurrentMulti = game.ServerStorage.StarterValues.Multiplier
local function IncreaseMulti(player)
	OldMulti.Value = CurrentMulti.Value
	wait(0.1)
	CurrentMulti.Value = CurrentMulti.Value * math.random(0.72,5)
	AnnouncementText.BackgroundColor = BrickColor.new('Camo')
	AnnouncementText.Visible = true
	wait(0.1)
	AnnouncementText.Text = player.."has Increased the Multiplier by "..CurrentMulti.Value - OldMulti.Value
	wait(3)
	AnnouncementText.Text = "The New Multiplier is "..CurrentMulti.Value.."."
	print(player.."has Increased the Multiplier by "..CurrentMulti.Value - OldMulti.Value)
	print("The New Multiplier is "..CurrentMulti.Value..".")
end

IncreaseMultiplier.OnServerEvent:Connect(IncreaseMulti)
2 Likes

AnnouncementText.Text = player.Name…"has Increased the Multiplier by "…CurrentMulti.Value - OldMulti.Value

2 Likes
AnnouncementText.Text = "The New Multiplier is "..CurrentMulti.Value.."."

this is line 15

3 Likes

you are trying to add a string with an instance. player is an instance but you did player.“string”

1 Like

Okay, it took me a while but the problem here is that “player” is an instance, or a game object, so use player.Name instead for it to be counted as a string :slight_smile:

1 Like

ok cool, but now the multiplier is only multiplying once.

If this is supposed to display on a UI and become updated, then it would be because you are changing the values in StarterGui, and not the Player’s personal UI.

Try using the player’s PlayerGui instead of StarterGui, for a current update. You can use this by referencing player.PlayerGui

I’m not too sure what you mean about it multiplying only once, but tell me if that is the issue.

and how do I display that for everyone?

loop through everyone’s player guis and change the text in their playergui

Try this! We use tostring() to make sure whatever we want to put in the string gets converted to a string value

AnnouncementText.Text = "The New Multiplier is "..tostring(CurrentMulti.Value).."."

Where fires the IncreaseMultiplier?
If it is locally, then you only have to use BindableEvent in this case.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local IncreaseMultiplier = ReplicatedStorage:WaitForChild("IncreaseMultiplier")
script.Parent.MouseButton1Click:Connect(function()
IncreaseMultiplier:FireServer()
end)

local script :DD

I don’t know how to use bindableevent btw. Can you give a script example?

maybe you could trying making currentMulti game.ServerStorage.StarterValues.Mulyiplier.Value?

got this now.
image

Doesn’t Really Change Anything, but Done.

I’m Having Issues with the Multiplier now.
heres my script

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local points = Instance.new("IntValue")
	points.Name = "Points"
	points.Parent = leaderstats
	local cooldown = game.ServerStorage.StarterValues.Cooldown.Value
	local multiplier = game.ServerStorage.StarterValues.Multiplier.Value
	while true do
		wait(cooldown)
		points.Value = points.Value + 1*multiplier
	end
	local data 
	local success, errormessage = pcall(function()
		data = playerData:GetAsync(player.UserId.."-points") 
	end)

	if success then 
		points.Value = data
	else
		print("Error while getting your data")
		warn(errormessage)
	end
end)

this is not the full script,

What kind of ‘issue’ are you having? Explain your problem detailed here otherwise people will struggle to help you without knowing your issue.

But i assume that your multiplier is stuck in 0?

If this code run in local script. Then you don’t want to store your StarterValues in ServerStorage (I mean this)

local multiplier = game.ServerStorage.StarterValues.Multiplier.Value

Local script can’t access ServerStorage unless you use RemoteEvent. Move your starter values to ReplicatedStorage so local script can access it.

As for your problem to display multiplier to every other player Gui. Learn about RemoteEvent (Full post and guide : Remote Functions and Events)

It’s very similar to RemoteEvents.

-- script A
local bindableEvent=Instance.new('BindableEvent')
bindableEvent.Parent=game:GetService('ReplicatedStorage')
wait(5)
binableEvent:Fire('Hello world!')

-- script B
local bindableEvent=game:GetService('ReplicatedStorage'):WaitForChild('BindableEvent')
bindableEvent.Event:Connect(function(message)
    print(message)
end)