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

Fireball is not a valid member of ReplicatedStorage "ReplicatedStorage"?

Asked by 3 years ago
Edited 3 years ago

For some reason when im presing the key to fire the fireball nothing happens and this error appears in the output tab

here are my scripts

local fireball = game.ServerStorage:WaitForChild("FireBall")

game.ReplicatedStorage.Fireball.OnServerEvent:Connect(function(player,CFrame)

    local character = player.Character
    local newFireball = fireball:Clone()
    newFireball.CFrame = character.HumanoidRootPart.CFrame

    local bodyVelocity = Instance.new("BodyVelocity")
    bodyVelocity.MaxForce = Vector3.new(5000,5000,5000)
    bodyVelocity.Velocity = (character.HumanoidRootPart.CFrame.lookVector*250)
    bodyVelocity.Parent = newFireball

    newFireball.Parent = workspace

    local touchConn

    touchConn = newFireball.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
            if hit.Parent.Name ~= player.Name then
                hit.Parent:BreakJoints()
                if touchConn ~= nil then touchConn:Disconnect() end
                newFireball:Destroy()
            end
        end
    end)

    wait(2)

    if touchConn ~= nil then touchConn:Disconnect() end
    newFireball:Destroy()

end)

local UserInputService = game:GetService("UserInputService")

local player = game.Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait(1)

local debounce = false

UserInputService.InputBegan:Connect(function(Input , IsTyping)
    if not IsTyping then
        if not debounce then

            debounce = true

            if Input.KeyCode == Enum.KeyCode.E then
                game.ReplicatedStorage.FireBall:FireServer()
            end

            wait(1)
            debounce = false
        end
    end
end)

Im not very experienced with coding so i would really apreciate if someona can help me with this

0
um, one question: did you put fireball inside replicatedstorage? ISkyLordDoge 37 — 3y

1 answer

Log in to vote
2
Answered by
2_MMZ 1059 Moderation Voter
3 years ago

I'm already seeing a few problems just from line one. In your title, you say that Fireball is part of ReplicatedStorage. But what I'm seeing is that you used ServerStorage in your script, or in your explorer. If it's in ServerStorage, move it to ReplicatedStorage, and change the script up.

Change the first two lines to this:

local fireball = game.ReplicatedStorage:WaitForChild("FireBall")

fireball.OnServerEvent:Connect(function(player, CFrame)

If this didn't help, and you are still receiving errors, please don't hesitate to let me know in Community Chat, or this answers comment section.

0
I think the fireball in the server storage is the actual part and the other fireball with the capital is the remoteevent. however it wasnt really clear from him ISkyLordDoge 37 — 3y
0
My knowledge for this question is only from what I've seen from him. We weren't really given a good explanation of where things are. But, I'm at least assuming that he confused ReplicatedStorage with ServerStorage. 2_MMZ 1059 — 3y
Ad

Answer this question