I'm making a script that gives the player one of the random items in Lighting when they spawn, but it doesn't work please help!
game.Players.PlayerAdded:connect(function(player)
player.Character.CharacterAdded:connect(function(char)
local i = Instance.new("BoolValue",player)
i.Name = "KnifeHolding"
if i
then end
else
i.Value = true
local mr = math.random(1,4)
if mr==1 then
local clone = game.Lighting.Blade:Clone()
clone.Parent = player.Backpack
elseif mr==2
local clone = game.Lighting.Bombos:Clone()
clone.Parent = player.Backpack
elseif mr==3
local clone = game.Lighting.DualKnives:Clone()
clone.Parent = player.Backpack
elseif mr==4
local clone = game.Lighting.InsaneKnife:Clone()
clone.Parent = player.Backpack
end)
local hum = char:FindFirstChild("Humanoid")
if hum then
hum.Died:connect(function(died)
i.Value = false
end)
end)

7 comments
None
Ok, what script type are you using?
Script Public.
Try a local script and try what i've edited my post into.
When you edited it , it gives me and error of On line 8 an end is above it doing something
Post the error.
Workspace.Script:8: 'end' expected (to close 'function' at line 3) near 'else'