Incomplete statement: expected assignment or a function call

Hello I ran into this issue when I was making a game where whenever you click the “Make Video” button it gives you a random amount of subscribers (it was just a test btw) and it also has to add 1 to the videos made textlabel.

heres my code and my error

local BackgroundMusic = game.Workspace.Song
local Yay = game.Workspace.Goody
local Click = game.Workspace.Click
local CounterTxt = script.Parent.Parent.Parent.Cntr.countTxt
local videosmade = script.Parent.Parent.Parent.VidCntr.countTxt.Text
local videomadewnt = script.Parent.Parent.Parent.VidCntr.countTxt

videomadewnt.Text = videomadewnt.Value.Value
videomadewnt.Value.Value = 0



BackgroundMusic.Looped = true
BackgroundMusic:Play()

script.Parent.MouseButton1Click:Connect(function()
	videomadewnt.Value.Value + 1

	Click:Play()
	CounterTxt.Text = (math.random(0, 100))
	Yay:Play()
end)
script.Parent.MouseButton1Click:Connect(function()
 
		script.Parent.Parent.Parent.madecntr.Visible = true
	wait(1)
	script.Parent.Parent.Parent.madecntr.Visible = false
end)

		


and heres my error:

please help im new AHHHHHHHHHHH

im not really i just suck AHHHHHHHHHHHHHHHHHHH

This is an incomplete statement and you need to put what you actually want here. Maybe you want this:

videomadewnt.Value.Value += 1
1 Like

it doesnt have an error in the output now, but it doesnt actually change the value at all.

Probably because it is in a LocalScript. Especially if you actually want the value to save to DataStores or use it for something else the server needs it to process, you need to add a RemoteEvent and add the value on the server.

1 Like

thank you so much! can you please add an example on what you mean though>?

1 Like

I just have one quick question, because I need it to know exactly what to give you back.


What exactly is this object

And is this a certain NumberValue or IntValue object, or is it something else? I think it’s an Int or NumberValue, but I could be wrong. Correct me if I am.

1 Like

It is an IntValue! Sorry for the late response!

It’s okay. No need to apologize


You’ll have to wait until I get home. I had the whole message typed out, but I was just waiting to be able to finish. It’s saved on my computer somewhere

1 Like

Okay! No worries, take your time!

Well, if you need to add a RemoteEvent into ReplicatedStorage, under any folders if you want to for organization.

Next thing, on the client, where you go to change the value, you just need to call the method FireServer() to basically send a message to the server saying “hey, you need to follow these instructions now. Here is the player that requested this, and any other data if they sent it.” That “other data” is typically referred to as “arguments.”

Here is how you do that:

local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("RemoteEvent" --[[Change this to whatever you name your RemoteEvent. This does matter if you name the RemoteEvent something else]])

script.Parent.MouseButton1Click:Connect(function()
	remoteEvent:FireServer(videomadewnt) --// You could pass whatever increase value you want through here, and it would send it to the server, but for that exact reason, I recommend against that. Exploiters can easily fire the RemoteEvent themselves and send whatever value they want. You should just be passing the object you want to change the value of so it is easier to access on the server.

	Click:Play()
	CounterTxt.Text = math.random(0, 100)
	Yay:Play()
end)

Now on the server, you need to process this using RemoteEvent.OnServerEvent, which is basically the server saying, “Okay, thank you, kind client. I appreciate you sending this message, now I will take your sent info and do this stuff with it.”

Here is the code you need to put into a server-sided script. Most preferably in ServerScriptService. You can name it something like “Events” for any use of RemoteEvents in the future (they are typically used a lot, along with RemoteFunctions, BindableEvents, and BindableFunctions. All documentation links can be viewed below):

local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("RemoteEvent" --[Change this to whatever you name your RemoteEvent. This does matter if you name the RemoteEvent something else]])

remoteEvent.OnServerEvent(player, obj)
	obj.Value.Value += 1
end)

With RemoteEvents, whenever you fire the server, the first argument is always the player. The “player” argument is required, and anything that is put there will be the player. That player argument, like said above, is the player of the client who fired the RemoteEvent.


I hope this helps, and please tell me if something doesn’t work right. I am glad to help until the situation is solved.


Documentation links:

1 Like

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