Trouble with Remote events and functions

I am doing a commision for someone who is making a donation game, everything is going to plan. But, i have 2 scripts under a button that will set its price and prompt you to buy the shirt. My problem is that when I call them, it doesnt ececute the funciton, like at all. It will call the print statements but not the remote event
I will give the important parts of the code here:
Local:


local function IdInvoke(request)
	if request == "Player" then
		return player
	elseif request == "TB text" then
		return textBox.Text
	end
end

local function onButtonPressed()
	
	repRemote:FireServer()
	print("check")
end

local function onTriggered()
	repRemote:FireServer(true)
	print("check")
end

repRemote.OnClientEvent:Connect(TweenUI)
dataFunc.OnClientInvoke = IdInvoke
button.Activated:Connect(onButtonPressed)
claimPrompt.Triggered:Connect(onTriggered)

Server:

local function UpdOwner(newOwner)
	owner = newOwner
	booth:SetAttribute("Owner", newOwner)
end

local function onClaim(player)
	claimPrompt.Enabled = false
	UpdOwner(player.UserId)
end

local function SetAssetId(player)
	print("check")
	local assetId
	if player.UserId == booth:GetAttribute("Owner") then
		print("check")
		repRemote:FireClient(true)
		assetId = datadataFunc:InvokeClient("TB text"):Wait()
		coroutine.wrap(function()
			repRemote:FireClient(false)
		end)()
		local asset = MPService:GetProductInfo(assetId, Enum.InfoType.Asset)
		if asset.PriceInRobux then
			button.Text = asset.PriceInRobux
			print("check")
		end
	else
		MPService:PromptPurchase(player, assetId, false, Enum.CurrencyType.Robux)
		print("check")
	end
	print("check")
end


local function PlayerRemoving(player, plr : Player)
	if plr.UserId == player.UserId then
		claimPrompt.Enabled = true
		print("check")
	end
	print("check")
end
local function decipher(player, var)
	print("check")
	if var then
		onClaim(player)
		print("check")
	else
		SetAssetId(player)
		print("check")
	end
end

--Events

repRemote.OnServerEvent:Connect(decipher)

All I need is to know why its not working, or a short snippet would be great also.
Thank you,
Sjdinsd.

1 Like

You have to specify what client to send the info to on the server:

RemoteEvent:FireClient(Player, ...)
1 Like

Aren’t donation games against the rules? I don’t really care about the issue personally but ive noticed stuff like “Pls Donate” and other begging places that would have been smashed by the moderation a while ago just freely floating around nowadays. I have no personal problems over those places existing but I was curious about it.

like i said it was for commision, I dont care what happens to they game aslong as I get paid im fine.

Yes, that was a mistake on my end, firing the client was for ui. The local script is my main issue, or recieving the call on the server end. But I cant figure out why its not calling, everything is setup right.

money is money, we can’t deny money (in most cases)

Also instead of using button.Activated using button.MouseButton1Click

I need it to work for mobile aswell, Your suggestion will stop that from working. And that isnt the cause, the print statements are going through, its just not working with the remote

1 Like

It will continue to work for mobile, I have used that function every single time and there was no problem at all. Even I, as a mobile player can prove this. Since I played my game (that uses that function) functions as if I was using .Activated.

Also, can I see the line that declares “repRemote” as the remoteevent in both scripts?

Its subjective tbh… Activated and MouseButton1Click work the exact same. :person_shrugging:

1 Like

Sure, Ill include a picture of my setup aswell
Server:
image
Local:
image
And here is the setup
image

1 Like

Try playing the game, but keep it client-sided and see if the event will show, if that fails try parenting the localscript and remoteevent to the button.

This could’ve also happened because ServerScripts do not work in UI buttons (i think). So try utilizing ServerScriptService, for the server script, and ReplicatedStorage, for the event.

1 Like

Ill send a video showing me playing with 2 characters, and what gets printed:

1 Like

I want to see the explorer client-sided. Open the part where the server script is located.

Its kinda weird to understand but instead of just 1 check going through there should be 3, no matter what. I have the server functions setup so that is the first thing that happens.
For the chekcs its one in the client, one in the decipher function, and one in server func

I know what are you trying to say, but can you put a print function on the very start of the server script to see if it’s actually working?

the remote func and event arent made by server but ill send the picture here:
image

and yes i updated the paths etc.

Alright, but can you still add a print function to the first line of the server script to see if it’s actually working?


it is working

It seems like you have a wait function? Maybe wait for like around 10 seconds and try again. I replicated this and it works as normal.