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

attempt to index local 'axe' (a nil value)... What should i do?

Asked by 5 years ago

hello, so... i need help with this thing: i have an Remote Event for equip the axe, but for some reason the argument is allways nil.

Script in ServerScriptService

game.ReplicatedStorage.equipChecker.OnServerEvent:Connect(function(player, axe)
local Char = player.Character
local Data = player:WaitForChild("Data")
axe.Parent = Char.AxeFolder
end)

LocalScript in StarterGui

local rs = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local Info = script.Parent.Parent
local Data = player:WaitForChild("Data")

script.Parent.MouseButton1Click:connect(function()
player.Data.AxeEquiped.Value = rs.Equips_FindFirstChild(Info.InfoText._Name.Text)    
local axe = Data_FindFirstChild("AxeEquiped").Value_Clone()    rs.equipChecker_FireServer(axe)end)

but in the output allways send: 22:47:23.116 - ServerScriptService.Event:58: attempt to index local 'axe' (a nil value) any ideia?

"AxeEquiped" is a ObjectValue; FE is enabled; All the remote events is in ReplicatedStorage.

0
You cannot create a instance or clone from a local script and send it to a server script using a remote event. The server script will always receive it as nil. hellmatic 1523 — 5y
0
Try sending the `AxeEquiped` object value and have the server script clone it instead of the local script hellmatic 1523 — 5y
0
Also why are you using underscores where they're should be colons User#19524 175 — 5y
0
OK! so yeah, it worked... Thanks!!. Also I did not use underscores, when I copied the code here appeared automatically and I did not realize. Caniisu 2 — 5y

Answer this question