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

ServerScriptService.Script:10: attempt to perform arithmetic (add) on number and Instance?

Asked by 2 years ago

i have a donation thing.

script.Parent.Parent.Frame.GenerateBox.Changed:Connect(function()
    game.Players.LocalPlayer.PlayerGui.DonateGampas.GenerValue.Value = game.Players.LocalPlayer.PlayerGui.DonateGampas.Frame.GenerateBox.Text
end)

^^ the value thats getting from a text box

the remote event sender:

local frame = script.Parent.Parent
clicked = false
script.Parent.MouseButton1Click:Connect(function()
    if clicked == false then
        if game.Players.LocalPlayer.PlayerGui.DonateGampas.GenerValue.Value > 10 then
            clicked = true
        script.Parent.Parent.warning.Visible = true
        script.Parent.Parent.warning.Text = "?? ?????? 10!"
            wait(3)
            script.Parent.Parent.warning.Visible = false
            clicked = false
        else
            clicked = true
            script.Parent.Parent.warning.Visible = true
            script.Parent.Parent.warning.Text = "????????? "..game.Players.LocalPlayer.PlayerGui.DonateGampas.GenerValue.Value + 2 .." ??????"
            wait(game.Players.LocalPlayer.PlayerGui.DonateGampas.GenerValue.Value + 2)
            game.ReplicatedStorage.GenerateEvent:FireServer(game.Players.LocalPlayer, game.Players.LocalPlayer.PlayerGui.DonateGampas.GenerValue.Value)
            clicked = false
            script.Parent.Parent.warning.Visible = false
        end
        end
end)

now the recieving

local id

game.ReplicatedStorage.GenerateEvent.OnServerEvent:Connect(function(player, valuee)
    id = player.UserId
    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(id, 41578622) then
        warn(id)
        warn(valuee)
        warn(player.leaderstats["???????"].Value)
        --warn(player.PlayerGui.DonateGampas.GenerValue.Value)
        player.leaderstats["???????"].Value += valuee
    else
        player:Kick("imagine exploiting ahahahahaha????")
    end
end)

but i cant add to leaderstats value an events function value.

1 answer

Log in to vote
0
Answered by 2 years ago

Problem

When you're firing to the server using :FireServer you don't need to pass a Player argument. It is automatically done for you.

Problem is located on line 17 in the second code block

Ad

Answer this question