Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How else can i define what the "blade" is if findfirstchild doesn't wanna do it?

So this is the script:

  local ev = script.Parent

local debounce = false

local Track = nil

  

ev.OnServerEvent:Connect(function(player)

local blade = player.Character:FindFirstChild("Blade")

player.PlayerStats.SwordExp.Value = player.PlayerStats.SwordExp.Value + 10

local scc = script.Script:Clone()

  

local Anim1 = script.anim1

local Anim2 = script.anim2

local char = player.Character or player.CharacterAdded:Wait()

if debounce == false then

debounce = true

Track = char.Humanoid:LoadAnimation(Anim1)

Track:Play()

  

scc.Parent = blade

  

game.Debris:AddItem(scc,.5)

else

debounce = false

Track = char.Humanoid:LoadAnimation(Anim2)

Track:Play()

  

scc.Parent = blade

  

end

  

if player.PlayerStats.SwordExp.Value / player.PlayerStats.MaxSwordExp.Value >= 1 then

player.PlayerStats.SwordLvl.Value = player.PlayerStats.SwordLvl.Value + 1

player.PlayerStats.MaxSwordExp.Value = player.PlayerStats.MaxSwordExp.Value + 10

player.PlayerStats.SwordExp.Value = 0

end

  

if player.PlayerStats.SwordLvl.Value <= 1 then

player.PlayerStats.MaxSwordExp.Value = 1000

end

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?

3 answers

✓ Accepted answer
  1. WaitForChild is your best friend
  2. Check if "Blade" is named properly. The *ForChild methods are case-sensitive.
  3. Make sure that "Blade" isn't being generated client-side. The server wont acknowledge that the blade is being created if it is.

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:

local blade = player.Character:WaitForChild("Blade")

Your friend, Spiral

2 comments

0

I forgot to mention that waitforchild also doesn't work

0

oh ok. rip

try this

if the blade is the parent of this script you can identify it by simply doing

local blade = script.Parent

or if it's something else, why not try:

local blade = player.Character.Blade

This discussion is preserved as it was. New answers, comments, and votes are closed.