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

Can anyone help? Line 7 contains the error.

Asked by
Spooce 78
9 years ago
local DataStore = game:GetService("DataStoreService"):GetDataStore("ByteBank")
local Player = game.Players:GetPlayerFromCharacter(Player)

script.Parent.Touched:connect(function(Hit)
    local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
    if (Humanoid ~= nil) then
    local ByteSpace = "user_" .. Player.userId
    local ByteIndex = {}
if os.difftime(os.time, ByteIndex[1]) >= 21600 then
    DataStore:UpdateAsync(ByteSpace, ByteIndex)
        ByteIndex[1] = os.time()
        ByteIndex[2] = ByteIndex[2] + 2
        Player.PlayerGui.ByteCount.Amount = Player.PlayerGui.ByteCount.Amount + 2
        end
    end
end)
0
It would be more helpful if you said what the error was VariadicFunction 335 — 9y

2 answers

Log in to vote
0
Answered by
Nexx 51
9 years ago

This line is grabbing a non existent value

local Player = game.Players:GetPlayerFromCharacter(Player)

You need to actually define the character, as in

Example:

local Player = game.Players:GetPlayerFromCharacter(game.Workspace['Player1'])
Ad
Log in to vote
0
Answered by 9 years ago

Player is nil do

local Player = game.Players.LocalPlayer --make sure it's in a local script not a regular.

:GetPlayerFromCharacter() is used for getting the Character from the Player.

Answer this question