So I have this database editor GUI that is supposed to change the amount of cash you have. But it does not work correctly.
Local Script:
script.Parent.MouseEnter:Connect(function()
if script.Parent.Text ~= "" then
script.Parent.BackgroundTransparency = 0
end
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.BackgroundTransparency = 1
end)
local debounce = false
script.Parent.MouseButton1Click:Connect(function()
if not debounce then debounce = true
wait()
if script.Parent.Text ~= "" then
local rs = game:GetService("ReplicatedStorage")
local ev = rs:WaitForChild("ENCRYPTED")
repeat wait() until ev
local whoFired = game.Players.LocalPlayer
local amount = script.Parent.Text
local otherPlayer = script.Parent.Parent.Parent.PlayerName.Text
ev:FireServer(whoFired,amount,otherPlayer)
wait(5)
debounce = false
end
end
end)
Server Script:
function en1(whoFired,amount,otherPlayer)
print(""..whoFired.." just gave".." "..otherPlayer.." +"..amount"$")
if otherPlayer ~= nil then
otherPlayer.leaderstats["Cash"].Value = amount
end
end
script.Parent.OnServerEvent:Connect(en1)
