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.
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.
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.
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
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?
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.
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