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

A Player Picker not working properly... Says stuff about nil value... Help?

local Players = game.Players:GetPlayers()
local TopHat = { }
fBeastSpawn = game.Workspace.Map1.MapData.BeastSpawns.fBeastSpawn
sBeastSpawn = game.Workspace.Map1.MapData.BeastSpawns.sBeastSpawn
BeastSpawns = {fBeastSpawn, sBeastSpawn}

table.insert(TopHat, Player)
for _, Player in pairs(Players) do
for i=1, Player.chancestats.RW.Value do 
TopHat[#TopHat + 1] = Player 
end
end

local Beast = TopHat[math.random(1, #TopHat)]
wait(30)

local scythe = game:service('ServerStorage'):findFirstChild('Scythe');
if scythe ~= nil then
scythe:clone().Parent = Beast:WaitForChild('Backpack');
game.Players.LocalPlayer.Backpack.scythe.Parent = game.Players.LocalPlayer.Character
end

local BHumanoid = Beast.Humanoid
BHumanoid.MaxHealth = "1000"
BHumanoid.Health = "1000"
BHumanoid.WalkSpeed = "20"

Beast.TeamColor = BrickColor.new("Really Black")

local Exp = Instance.new("SpecialMesh",Beast.Torso)
Exp.MeshType = Enum.MeshType.FileMesh
Exp.MeshId = "http://www.roblox.com/asset/?id=42579239"
Exp.TextureId = "http://www.roblox.com/asset/?id=42578558"
Exp.VertexColor = Color3.new(-90, -100, 47)
Exp.Scale = Vector3.new(10, 10, 10)

local CBSpawn = BeastSpawns[math.random(1, #BeastSpawns)]
Beast:MoveTo(CBSpawn.Position)

3 comments

0

Jesus Christ!!!!!!!!!!!! I a gave my Script and yas aren't Happy!!? wat the hell!!? Thumbs Down for nothin! the guy that did this is seriously Stupid!

0

._.

0

._.

2 answers

On the 17 line,

local scythe = game:service('ServerStorage'):findFirstChild('Scythe');

Have you tried putting your "scythe" in lighting? So try copying your script on a separate script in workspace,

1 comment

0

but if a Player is picked he cant be Defined as his Name cant be changed... and so my only choice is inside the same script cos then the system knows that the Beast is the picked Player

Change:

local scythe = game:service('ServerStorage'):findFirstChild('Scythe');

To:

local scythe = game.SeverStorage:findFirstChild("Scythe")

:service() is deprecated.

2 comments

0

k, thnx... and wat u mean depricated?

0

You could google it, but it basically means Roblox used to use it, but not anymore, like :children(). Now you should use :GetChildren() instead of :children() and :GetService() instead of :service.

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