For some reason, it keeps printing “reward” as nil, despite the fact that it isn’t nil (I’ve tested)
Output: nil, true
Local script
local Data = game.Players.LocalPlayer:FindFirstChild("Data_Folder")
local cooldown = false
script.Parent.MouseButton1Click:Connect(function()
if cooldown == false then
cooldown = true
script.Parent.click:Play()
local success, reward = game.ReplicatedStorage.Events.CrateBuy:InvokeServer('Normal')
if success == true then
print(reward, success)
print(tostring(reward))
script.Parent["Cash sound"]:Play()
cooldown = false
else
script.Parent.error:Play()
script.Parent.Text = 'Insufficient'
wait(1)
script.Parent.Text = 'Buy'
cooldown = false
end
end
end)
Server Script
game.ReplicatedStorage.Events.CrateBuy.OnServerInvoke = function(player, data)
if data == 'Normal' then
local Data = player:FindFirstChild("Data_Folder")
if Data.Coins.Value >= 25 then -- price of Gold/Mormal Crates
print('Bought Crate')
Data.Coins.Value = Data.Coins.Value - 25
local gotResult = NormalDryer()
print(gotResult) -- prints a string, I've checked
return true, gotResult
else
return false
end
end
end