So this is the script:
01 | local ev = script.Parent |
02 |
03 | local debounce = false |
04 |
05 | local Track = nil |
06 |
07 | |
08 |
09 | ev.OnServerEvent:Connect( function (player) |
10 |
11 | local blade = player.Character:FindFirstChild( "Blade" ) |
12 |
13 | player.PlayerStats.SwordExp.Value = player.PlayerStats.SwordExp.Value + 10 |
14 |
15 | local scc = script.Script:Clone() |
16 |
17 | |
18 |
19 | local Anim 1 = script.anim 1 |
20 |
21 | local Anim 2 = script.anim 2 |
22 |
23 | local char = player.Character or player.CharacterAdded:Wait() |
24 |
25 | if debounce = = false then |
26 |
27 | debounce = true |
28 |
29 | Track = char.Humanoid:LoadAnimation(Anim 1 ) |
30 |
31 | Track:Play() |
32 |
33 | |
34 |
35 | scc.Parent = blade |
36 |
37 | |
38 |
39 | game.Debris:AddItem(scc,. 5 ) |
40 |
41 | else |
42 |
43 | debounce = false |
44 |
45 | Track = char.Humanoid:LoadAnimation(Anim 2 ) |
46 |
47 | Track:Play() |
48 |
49 | |
50 |
51 | scc.Parent = blade |
52 |
53 | |
54 |
55 | end |
56 |
57 | |
58 |
59 | if player.PlayerStats.SwordExp.Value / player.PlayerStats.MaxSwordExp.Value > = 1 then |
60 |
61 | player.PlayerStats.SwordLvl.Value = player.PlayerStats.SwordLvl.Value + 1 |
62 |
63 | player.PlayerStats.MaxSwordExp.Value = player.PlayerStats.MaxSwordExp.Value + 10 |
64 |
65 | player.PlayerStats.SwordExp.Value = 0 |
66 |
67 | end |
68 |
69 | |
70 |
71 | if player.PlayerStats.SwordLvl.Value < = 1 then |
72 |
73 | player.PlayerStats.MaxSwordExp.Value = 1000 |
74 |
75 | end |
76 |
77 | end ) |
I need to put that scc script into the blade when needed which should work but doesn’t cause i cannot manage to define the blade properly.
Any ideas how to fix this?
Overall, if WaitForChild doesn’t find it ever, then that means that it’s never being created or moved. WaitForChild can and will find something, no matter how long it takes. Make sure that “Blade” is actually being created. You may have forgotten to clone it, or something. If it’s an equippable object, the model won’t be moved into the player until it is equipped.
In stead of FindFirstChild use WaitForChild. Heres an Example:
1 | local blade = player.Character:WaitForChild( "Blade" ) |
Your friend, Spiral
try this
if the blade is the parent of this script you can identify it by simply doing
1 | local blade = script.Parent |
or if it’s something else, why not try:
1 | local blade = player.Character.Blade |