So in my script, It says that the character that is hit by it gets blown back and I have a variable called player that defines game.players.localplayer but it says that player is a nil value in the output. 19:43:56.331 - Players.AM910SK.Backpack.Rasengan.Script:11: attempt to index upvalue 'player' (a nil value)
Script:
local player = game.Players.LocalPlayer -- this is the variable player
local handle = script.Parent.Handle
local debounce = false
handle.Touched:Connect(function(hit)
if not debounce and hit.Parent.Humanoid then
debounce = true
hit.Parent.Humanoid:TakeDamage(50)
local blowback = Instance.new("BodyVelocity")
blowback.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
blowback.Velocity = player.Character.HumanoidRootPart.CFrame.lookVelocity*50 --it says that player is a nil value right here
hit.Parent.Humanoid.Sit = true
game.Debris:AddItem(blowback, 1.2)
wait(3)
debounce = false
end
end)
