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

Why is my shuriken killing me instead of throwing it?

Asked by
Mr_Unlucky 1085 Moderation Voter
6 years ago
Edited 6 years ago

I made a shuriken, and when I throw it, it kills me instead. Help! There's no errors either. Just an infinite yield on ":WaitForChild()"

01local Tool = script.Parent.Parent
02local Player = game:GetService("Players").LocalPlayer
03--local Animations = Tool.Animations
04--local ThrowAnimation = Animations.ThrowAnimation
05local Debounce = false
06local ThrowSound = Tool.Handle.Throw
07local Mouse = Player:GetMouse()
08local PlayAnimation = game:GetService("ReplicatedStorage"):WaitForChild("PlayAnimation")
09local StopAnimation = game:GetService("ReplicatedStorage"):WaitForChild("StopAnimation")
10Tool.Activated:Connect(function()
11    if Debounce == false then
12        Debounce = true
13        ThrowSound:Play()
14        Throw()
15        wait(0.201)
View all 32 lines...
0
You're supposed to use a FindFirstChild, not WaitForChild. You are waiting for a humanoid which does not exist, and therefore yields the script. Also, you should connect Throw to the Touched event User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by
Hizar7 102
6 years ago

I'm not too faimilar with clone but i believe you had that wrong, I am using a new part as a substitute. Also you needed to add a maxForce and a new cframe for the part, let me know if this works for you! :)

01local Tool = script.Parent
02    local Player = game:GetService("Players").LocalPlayer
03    local Animations = Tool.Animations
04    local ThrowAnimation = Animations.ThrowAnimation
05    local Debounce = false
06    local ThrowSound = Tool.Handle.Throw
07    local Mouse = Player:GetMouse()
08    local PlayAnimation = game:GetService("ReplicatedStorage"):WaitForChild("PlayAnimation")
09    local StopAnimation = game:GetService("ReplicatedStorage"):WaitForChild("StopAnimation")
10    Tool.Activated:Connect(function()
11        if Debounce == false then
12        Debounce = true
13           -- ThrowSound:Play()
14            Throw()
15            wait(0.201)
View all 36 lines...
Ad

Answer this question