I have a script that blows people back but doesn't work any ideas?
Asked by
5 years ago Edited 5 years ago
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:
01 | local player = game.Players.LocalPlayer |
02 | local handle = script.Parent.Handle |
05 | handle.Touched:Connect( function (hit) |
06 | if not debounce and hit.Parent.Humanoid then |
08 | hit.Parent.Humanoid:TakeDamage( 50 ) |
09 | local blowback = Instance.new( "BodyVelocity" ) |
10 | blowback.MaxForce = Vector 3. new( math.huge , math.huge , math.huge ) |
11 | blowback.Velocity = player.Character.HumanoidRootPart.CFrame.lookVelocity* 50 |
12 | hit.Parent.Humanoid.Sit = true |
13 | game.Debris:AddItem(blowback, 1.2 ) |