So I am currently trying to make it so a remote event is fired from the client side to the server side but for some reason it is either not fireing from the client or not collecting it on the server. I am not sure why cuz I swear this should work fine.
Client:
mainshopui.TurtuelBuy.TextButton.MouseButton1Click:Connect(function()
print("Four")
if playerlocal.MoneyValue.Value >= 20 then
print("Five")
game.ReplicatedStorage.Events.Money.PurcasePet:FireServer("Frog")
mainshopui.TurtuelBuy.TextButton.Text = "OWNED"
end
end)
Server:
game.ReplicatedStorage.Events.Money.PurcasePet.OnServerEvent:Connect(function(plr, pet)
print("One")
if pet == "Frog" then
print("Two")
if plr:FindFirstChild("MoneyValue").Value >= 20 then
print("Three")
petPurchase(frogStore, 20, plr)
end
end
end)
I think the issue is within the firing or collecting of the remote event cuz it runs the prints I put on the client but not the first print on the server. There is no errors related to this script either by the way in the output
There is but there is no errors I can see in the output which I would expect.
Full server script:
local DSS = game:GetService("DataStoreService")
local players = game:GetService("Players")
local moneystore = DSS:GetDataStore("Moneystore")
local frogStore = DSS:GetDataStore("pet_frog")
game.Players.PlayerAdded:Connect(function(plr)
local new = Instance.new("NumberValue", plr)
new.Name = "MoneyValue"
local success, errormessage pcall(function()
local moneyamount = moneystore:GetAsync("User_"..plr.UserId)
new.Value = moneyamount
game.ReplicatedStorage.Events.Money.ChangeUI:FireClient(plr, moneyamount)
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
local success, errormessage pcall(function()
moneystore:SetAsync("User_"..plr.UserId, plr:FindFirstChild("MoneyValue").Value)
end)
end)
while true do
wait(1200)
for i, v in pairs(players:GetChildren()) do
v:FindFirstChild("MoneyValue").Value = v:FindFirstChild("MoneyValue").Value + 20
game.ReplicatedStorage.Events.Money.ChangeUI:FireClient(v, v:FindFirstChild("MoneyValue").Value + 20)
end
end
local function petPurchase(petDatastore, price, plr)
local success, errormessage pcall(function()
local petownership = petDatastore:GetAsync("User_"..plr.UserId)
if petownership == nil then
print("True")
plr.MoneyValue.Value = plr.MoneyValue.Value - price
petDatastore:SetAsync("User_"..plr.UserId, true)
plr.PlayerGui.MainGui.mainshopui.Balance.Value.Text = "CJ$"..plr.MoneyValue.Value - 20
plr.PlayerGui.MainGui.Currency.MoneyValue.Text = plr.MoneyValue.Value - 20
end
end)
end
game.ReplicatedStorage.Events.Money.PurcasePet.OnServerEvent:Connect(function(plr, pet)
print("One")
if pet == "Frog" then
print("Two")
if plr:FindFirstChild("MoneyValue").Value >= 20 then
print("Three")
petPurchase(frogStore, 20, plr)
end
end
end)