Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Knife throw script not working?

Asked by 4 years ago
Edited 4 years ago

So I'm currently making a throwing knife script but when the remote server is fired an error popped up saying 20:06:36.909 - ServerScriptService.The World.Knife Throw:24: attempt to perform arithmetic (mul) on nil and number

There's a local script and a normal script

local script

01local plr = game:GetService("Players").LocalPlayer
02 
03local rp = game:GetService("ReplicatedStorage")
04local KnifeThrow = rp:WaitForChild("The World:Remotes"):WaitForChild("KnifeThrow")
05 
06local UIS = game:GetService("UserInputService")
07 
08local debounce = false
09local cooldown = 0.75
10 
11 
12UIS.InputBegan:Connect(function(input,IsTyping)
13   if IsTyping then
14      return
15   elseif input.KeyCode == Enum.KeyCode.T then     
View all 33 lines...

Normal script

01local rp = game:GetService("ReplicatedStorage")
02local knife = rp:WaitForChild("The World:Remotes"):WaitForChild("KnifeThrow")
03local Debris = game:GetService("Debris")
04 
05local TweenService = game:GetService("TweenService")
06 
07local damage = 6.25
08 
09knife.OnServerEvent:Connect(function(Player,LookAt)
10   local Character = Player.Character
11   local Humanoid = Character:WaitForChild("Humanoid")
12   local HumanoidRP = Character:WaitForChild("HumanoidRootPart")
13 
14   local thr = Humanoid:LoadAnimation(script:WaitForChild("Throw"))
15   thr:Play()
View all 34 lines...
0
You didn't pass the LookAt variable. Ziffixture 6913 — 4y

1 answer

Log in to vote
1
Answered by
FirezDevv 162
4 years ago

Looks like you forgot to pass the lookat variable

heres a little fix for your at line 27 of the local script

1KnifeThrow:FireServer(LookAt)
0
oh no wonder why thanks! I was just tired Eric_pokemon 133 — 4y
Ad

Answer this question