ServerScriptService.AttackModeLeaderboard:42: attempt to index nil with 'Name’
still gives the same error
Can you provide the entire console output?
theres also 1 above which prints out the table when player joins the game, which works perfectly alright
The one above the table: asdafjsdkf Is your name right?
no it doesnt print the name, my name is A5LNX on roblox not asdafjsdkf
local player = Players:GetPlayerFromCharacter(character)
This is where the error comes from, the variable is nil, which means you couldnt get the player from character somehow.
in the output it prints player as nil
Can you post the ENTIRE console output? Not just a little snipet?
well the whole output its filled with errors which are not relevant to this case, those are the only ones that are related to this error
local player = Players:GetPlayerFromCharacter(character)
Try changing this to:
local player = game.Players:FindFirstChild(character.Name)
Maybe this will get the player correctly.
Or you can try this local player = allPlayers[character.Name]
both solutions dont work, and give same error
What does it print when you try to print character in the event?
And also what activates this event: AttackModeActivated.Event?
It prints out: Body
and this here activates it (script in a part)
local Stage2 = script.Parent
local AttackModeActivated = game.ServerStorage.AttackModeActivated
Stage2.Touched:Connect(function(otherPart)
local model = otherPart:FindFirstAncestorOfClass("Model")
AttackModeActivated:Fire(model)
end)
Is “Body” your name? Or is it referring to another part in your character?
Change it to this:
You were basically sendin a body part instead of a character.
local Stage2 = script.Parent
local AttackModeActivated = game.ServerStorage.AttackModeActivated
Stage2.Touched:Connect(function(otherPart)
AttackModeActivated:Fire(otherPart.Parent)
end)
Try this:
local Stage2 = script.Parent
local AttackModeActivated = game.ServerStorage.AttackModeActivated
Stage2.Touched:Connect(function(otherPart)
print(otherPart)
print(otherPart.Parent)
print(otherPart.Parent.Parent)
print(otherPart.Parent.Parent.Parent)
print(otherPart.Parent.Parent.Parent.Parent)
print(otherPart.Parent.Parent.Parent.Parent.Parent)
AttackModeActivated:Fire(otherPart.Parent)
end)
And post the output of the console
How are you putting the Value in the character?
A script when players join?
Ah, just saw the second reply, maybe say in the main post that you’re putting the value in the player via a script.