Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

2 comments

0

the title aint real so :/

0

-_- The problem is that LocalPlayer doesn't work on server, but with the client.

2 answers

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 comment

1

Also try highlighting individual sections and run the script to pin point where the exact error is coming from

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.