Can you explain what happens after calling the function? And are there any errors?
There are no errors, and what happens is that the fireball spawn but the linearVelocity has no effect
Try Debugging I guess with prints everywhere
oh… well that was the problem? i thought something else
For some reason it didn’t show errors last time but now it shows two:
21:03:07.952 ReplicatedStorage.BossAttacks:4: attempt to index nil with ‘Character’ - Server - BossAttacks:4 and
21:03:07.952 Requested module experienced an error while loading - Server - Script:2
Try
function BossAttacks:BossAttacksFireBalls(boss)
local fireball = game.ReplicatedStorage.FireBall:Clone()
fireball.Parent = workspace
fireball.Position = boss.PrimaryPart.Position
local Direction = char.PrimaryPart.Position - boss.PrimaryPart.Position
fireball.Velocity = Direction.Unit * 1000 -- Set the Velocity property correctly
end
It does not work as i am using linearVelocity but you seem to be using just velocity which does not work
Ah 1 second, you call localplayer from module script?
You should also try changing:
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
LocalPlayer only works in LocalScript
Still same error it does not seem to be a typo
That does seem plausible to be a problem…
What type of script is the original requiree of the module?
A local script so its not localplayer
I see. I think you should try along the lines of
local selectedPlayer = game.Players:GetPlayers(); selectedPlayer = selectedPlayer[math.random(1, #selectedPlayer)]
local char = selectedPlayer.Character or selectedPlayer.CharacterAdded:Wait()
and changing the boss attack requiree script to a server script.
You call it from ModuleScript right?
it calling from to functions
(boss) to (player, boss)
then call it with target player however you plan to do it with
Can you show both module script and The script to call that function (I mean is it from script or local script)
Its says: 21:13:59.615 ReplicatedStorage.BossAttacks:4: invalid argument #2 to ‘random’ (interval is empty) - Server - BossAttacks:4
I see. I think you should add
if not game.Players:GetPlayers() then
game.Players.PlayerAdded:Wait()
end
before the random check.
It still does not work and leave your messages there as i will test them out tomorow and i am going to sleep
Try This for Player Call in ModuleScript
local BossAttacks = {}
local pathfindingService = game:GetService("PathfindingService")
local TweenService = game:GetService("TweenService")
function BossAttacks:SummonMinions(player, boss)
local Character = player.Character
local zombies = {game.Workspace["Zombie-Type-1"], game.Workspace["Zombie-Type-32"]}
local clones = 10
repeat
for i, v in pairs(zombies) do
local clone = v:Clone()
clone.Parent = workspace
clone:PivotTo(boss.PrimaryPart.CFrame)
clones -= 1
end
until clones == 0
end
function BossAttacks:BossAttacksFireBalls(player, boss)
local Character = player.Character
local fireball = game.ReplicatedStorage.FireBall:Clone()
fireball.Parent = workspace
fireball.Position = boss.PrimaryPart.Position
local Direction = char.PrimaryPart.Position - boss.PrimaryPart.Position
local velo = fireball.LinearVelocity
velo.LineDirection = Direction
velo.LineVelocity = 1000
end
return BossAttacks