I put my part named "FireBall" in ReplicatedStorage. Inside "FireBall" there is Attachment but the Output says "Attachment is not a valid member of part."
I will put part of my script below. Tell me if you need the whole script to answer me.
-- Variables -- local Remote = ReplicatedStorage.FireBallEvent local FireBall = ReplicatedStorage.FireBall Remote.OnServerEvent:Connect(function(plr, Mouse) if not ServerDebounces[plr] then ServerDebounces[plr] = true -- Settings -- local Char = plr.Character or plr.CharacterAdded:Wait() local FireBallClone = FireBall:Clone() local Enemy = Hum.Parent.Humanoid Enemy:TakeDamage(Damage) BodyVelocity:Destroy() FireBallClone.Attachment.Effect.Speed = NumberRange.new(8,8) wait(1) FireBallClone.Attachment.Effect.Enabled = false FireBallClone.Attachment.SmokeEffect.Enabled = false wait(1) FireBallClone:Destroy()
I don't know why it says that Attachment is not a valid member of part.
Effect and SmokeEffect is inside Attachment. and Attachment is inside the FireBall and FireBallClone is cloned FireBall. So Attachment is supposed to be inside FireBallClone isn't it?
As TheeDeathCaster said, the script loaded before the attachment did. Add local attachment = FireBallClone:WaitForChild("Attachment")
somewhere and replace FireBallClone.Attachment
on the other lines with attachment
.
And here's your script that should be fixed by now.
-- Variables -- local Remote = ReplicatedStorage.FireBallEvent local FireBall = ReplicatedStorage.FireBall Remote.OnServerEvent:Connect(function(plr, Mouse) if not ServerDebounces[plr] then ServerDebounces[plr] = true -- Settings -- local Char = plr.Character or plr.CharacterAdded:Wait() local FireBallClone = FireBall:Clone() local attachment = FireBallClone:WaitForChild("Attachment") local Enemy = Hum.Parent.Humanoid Enemy:TakeDamage(Damage) BodyVelocity:Destroy() attachment.Effect.Speed = NumberRange.new(8,8) wait(1) attachment.Effect.Enabled = false attachment.SmokeEffect.Enabled = false wait(1) FireBallClone:Destroy()
Put these two in StarterPack:
For pressing key: (Local Script)
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local RemoteEvent = game.Workspace.Fired local UIS = game:GetService("UserInputService") local Debounce = false UIS.InputBegan:Connect(function(Input, gameProcessed) if Input.KeyCode == Enum.KeyCode.F and gameProcessed == false then if Debounce == true then return end Debounce = true RemoteEvent:FireServer() wait(0.5) -- Change the interval between each fireball Debounce = false end end)
Fireball creation (Normal Script)
game.Workspace.Fired.OnServerEvent:Connect(function(Player, Debounce) local AlreadyTouched = false local Character = Player.Character or Player.CharacterAdded:wait() local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://846744780" animation = Character.Humanoid:LoadAnimation(animation) animation:Play() ----- Active animation wait(0.5) local Fireball = Instance.new("Part") local Fire = Instance.new("ParticleEmitter",Fireball) Fireball.Name = "Fireball" Fireball.Shape = Enum.PartType.Ball Fireball.Size = Vector3.new(2,2,2) Fireball.Material = Enum.Material.Neon Fireball.BrickColor = BrickColor.new("Deep orange") Fireball.CanCollide = false Fire.LightEmission = NumberRange.new(0.35) Fire.LightInfluence = NumberRange.new(0) Fire.Texture = "rbxassetid://405886187" Fire.Lifetime = NumberRange.new(0.5) Fire.Rate = 20 Fire.Speed = NumberRange.new(3) Fire.SpreadAngle = Vector2.new(15.15) Fireball.Parent = Character Fireball.CFrame = Character.HumanoidRootPart.CFrame*CFrame.new(0,1,-3) local BV = Instance.new("BodyVelocity") BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge) BV.Velocity = Character.HumanoidRootPart.CFrame.lookVector*100 BV.Parent = Fireball Fireball.Touched:Connect(function(Hit) local Humanoid = Hit.Parent:FindFirstChild("Humanoid") if Humanoid == nil then return end if AlreadyTouched == false then AlreadyTouched = true local debris = game:GetService("Debris") if Humanoid then local creatorTag = Instance.new("ObjectValue") creatorTag.Value = Player creatorTag.Name = "creator" creatorTag.Parent = Humanoid debris:AddItem(creatorTag, 1) end; if Humanoid.Parent == Character then Humanoid.Health = Humanoid.Health - 0 else Humanoid.Health = Humanoid.Health - Humanoid.MaxHealth/2 Fireball:Destroy() end end end) wait(3) Fireball:Destroy() end)
And finally make a RemoteEvent in Workspace named "Fired"