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

attempt to index upvalue 'base' (a function value)?

Asked by 6 years ago

Help me with this please when i play it in a game it wont work but in studio when i test it it work help ples

plrs = game:GetService("Players")
Monsty = game:GetService("ServerStorage").Monsty
Jebus = Monsty:Clone()
Jebus.Name = "Christ"
Stuff = Jebus:GetChildren()
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
    print("is this working?")
    local Player = game:GetService("Players").LocalPlayer
    Player.Character:ClearAllChildren()
    for i,v in pairs(Stuff) do
        local Holy = v
        Holy.Parent = Player.Character
    end
    Jebus:Destroy()
    game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false
end)

0
the title aint real so :/ Cyrellejheff 11 — 6y
0
-_- The problem is that LocalPlayer doesn't work on server, but with the client. Meltdown81 309 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago

In this case it looks base is a function, but you're trying to index it like a table (eg. base[5] or base.somefield). The 'upvalue' part is just telling you what kind of variable base is, in this case an upvalue (aka external local variable)

1
Also try highlighting individual sections and run the script to pin point where the exact error is coming from The_Pr0fessor 595 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

I have a tricky history with remoteEvents and its siblings so this might not work.

--Script
local monsty = game.ReplicatedStorage.Monsty    --Place it in ReplicatedStorage so localscripts can access it

local remote = game.ReplicatedStorage.RemoteEvent.OnServerEvent:connect(function(ply)
    local cha = ply.Character
    local jebus = monsty:Clone()
    cha:ClearAllChildren()

    for i,v in pairs(jebus:GetChildren()) do
        v.Parent = cha
    end

    jebus:Destroy()
    ply.PlayerGui:FindFirstChild("ScreenGui").Frame.Visible = true
end)

I'm unsure if this will kill the player.

Answer this question