Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What's the problem with this?

Asked by
viison -5
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

error is FireServer is not a valid member of RemoteFunction Script 'players.player1.playergui.sidebar.buttons.donate.donatebackg', Line 38 stack end

local Plr = game.Players.LocalPlayer
local Globals = require(game.Workspace["Globals"])
local Name = script.Parent:WaitForChild("Name")
local Amount = script.Parent:WaitForChild("Amount")
local Send = script.Parent:WaitForChild("Send")
local DonateButton = script.Parent.Parent
local ButtonP = Globals.GetButton(Plr)

DonateButton.MouseButton1Click:connect(function()
    script.Parent.Visible = not script.Parent.Visible
    if not script.Parent.Visible then
        Globals.DeleteGui(Plr,"PrivateSelling")
    else
        for i,v in pairs(DonateButton.Parent:GetChildren()) do
            if v ~= DonateButton then
                v:GetChildren()[1].Visible = false
            end
        end
    end
end)

Globals.BPreference(Send,ButtonP)
Globals.BPreference(DonateButton,ButtonP)
Globals.BPreference(script.Parent,Globals.GetBackground(Plr))
Globals.ColorPreference(DonateButton,Globals.GetColor(Plr),"TextColor3")

Amount.Changed:connect(function()
    if tonumber(Amount.Text) then
        Amount.Text = math.abs(Amount.Text)
    end
end)

Send.MouseButton1Click:connect(function()
    local Donatee = Globals.FindPlayer(Name.Text)
    if Donatee and tonumber(Amount.Text) then
        local Donation = math.abs(Amount.Text)
        if Globals.GetRobux(Plr) >= Donation then
            workspace["AwardRobux"]:FireServer({Donatee,Donation,false}) 
            workspace["RemoveRobux"]:FireServer({Plr,Donation,false})
            coroutine.resume(coroutine.create(function()
                Globals.Notify(Plr,nil,"Donated "..Donation.." to "..Donatee.Name.."!",7)
            end))
            Globals.Notify(Donatee,nil,Plr.Name.." has donated "..Donation.." to you!",7)
        else
            Globals.Notify(Plr,nil,"Not enough robux!",7)
        end
    elseif not Donatee then
        Globals.Notify(Plr,nil,Name.Text.." not found!",7)
    elseif not tonumber(Amount.Text) then
        Globals.Notify(Plr,nil,"Numbers only!",7)
    end
end)

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

As the error says, :FireServer is not a property of RemoteFunctions.

FireServer is a method if RemoteEvents.


Use :InvokeServer instead (or a RemoteEvent, if that's what you want)

Ad

Answer this question