"Expected identifier when parsing expression, got malformed string"

I keep getting this error on line 8

"Expected identifier when parsing expression, got malformed string"

Here is the whole script:

local RemoteEvents = game.ReplicatedStorage:WaitForChild("RemoteEvents")
local AbilityEvents = RemoteEvents:WaitForChild("AbilityEvents")
local FireballEvent = AbilityEvents:WaitForChild("Fireball")
local RockEvent = AbilityEvents:WaitForChild("EarthBasic")

local StoneMod = require(script:WaitForChild("StoneAttackModule"))
local FireballMod = require(script:WaitForChild("FireballAttackModule"))

RockEvent.OnClientEvent:Connect(function(plr, MousePos, Speed, Size)
	StoneMod.BasicAttack(plr, MousePos, Speed, Size)

FireballEvent.OnClientEvent:Connect(function(plr, MousePos, Speed, Size)
	FireballMod.ShootBall(plr, MousePos, Speed, Size)

This error is stopping the whole script from working and I have no idea what parsing is or what a “malformed string” is…

For context: I have a local script which waits for a remote event which is fired to all clients. The local script has to module scripts in it. The first handles the graphics to a rock attack and the second handles graphics to the fireball attack.

Btw the rock module script works fine, the script just gets stuck on requiring the fireball module. If you need the fireball module script to help me, please ask and i’ll post it in the comments because its pretty long.


Here is the fireball module that is causing problems:

local RemoteEvents = game.ReplicatedStorage:WaitForChild("RemoteEvents")
local KnockbackEvent = RemoteEvents:WaitForChild("Knockback")
local PhysicsService = game:GetService("PhysicsService")
local TweenService = game:GetService("TweenService")
local Fireball = script:WaitForChild("Fireball")
local FireAOE = script:WaitForChild("FireAOE")
local Explotion = script:WaitForChild("Explotion")

local FireballMod = {}

FireballMod.ShootBall = function(plr, MousePos, Speed, Size)
	local Projectile = Fireball:Clone()
	game.Debris:AddItem(Projectile, 15)
	Projectile.CollisionGroup = "Projectile"
	Projectile.Position = plr.Character.RightHand.Position+Vector3.new(0, 1, 0)
	Projectile.Velocity = CFrame.new(Projectile.Position, MousePos).LookVector*Speed
	Projectile.Size = Vector3.new(Size, Size, Size)
	Projectile.Parent = workspace.EffectStorage
	Projectile.PointLight.Range = Size*3

		if hit:IsDescendantOf(plr.Character) or hit:IsDescendantOf(workspace.EffectStorage) then return end
		if Projectile:FindFirstChild("Touched") then return end

		local RaycastParam = RaycastParams.new()
		RaycastParam.FilterType = Enum.RaycastFilterType.Exclude
		RaycastParam.FilterDescendantsInstances = {workspace.EffectStorage}
		local RaycastResult = workspace:Raycast(Projectile.Position, Vector3.new(0, -(Size/2+1),0), RaycastParam)
		if RaycastResult then
			local TC = Instance.new("BoolValue", Projectile)
			TC.Name = "Touched"
			Projectile.Anchored = true
			Projectile.CanCollide = false
			Projectile.Position = RaycastResult.Position
			Projectile.FIRE.Enabled = false
			Projectile.GLOW.Enabled = false
			Projectile.SPECKS.Enabled = false
			--Fade Out Projectile
					Projectile.Transparency += 0.1
				until Projectile.Transparency >= 1
			TweenService:Create(Projectile.PointLight, TweenInfo.new(2), {Range = 0}):Play()
			game.Debris:AddItem(Projectile, 2)

			local FireZone = FireAOE:Clone()
			FireZone.Size = Vector3.new(Size*3.5, 1.482, Size*3.5)
			FireZone.Position = RaycastResult.Position
			FireZone.CFrame = CFrame.new(FireZone.Position, FireZone.Position+RaycastResult.Normal)*CFrame.Angles(math.rad(-90),0,0)
			FireZone.Parent = workspace.EffectStorage
			FireZone.PointLight.Range = Size*3.5
			--Fade Out Fire AOE
			game.Debris:AddItem(FireZone, 5)
			TweenService:Create(FireZone.PointLight, TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {Range = 0}):Play()
			TweenService:Create(FireZone.FireIdle, TweenInfo.new(5), {Volume = 0}):Play()
				FireZone["BURNING FLOOR"].Enabled = false
				FireZone.FLAMES.Enabled = false
				FireZone.GLOW.Enabled = false
				FireZone.SPECKS.Enabled = false

			local Exp = Explotion:Clone()
			Exp.Position = RaycastResult.Position
			Exp.Parent = workspace.EffectStorage
			Exp.PointLight.Range = Size*3

			if hit.Parent then
				if hit.Parent:FindFirstChild("Humanoid") then
					KnockbackEvent:FireServer(plr.Character.HumanoidRootPart, hit.Parent.HumanoidRootPart)
			--Fade Out
			game.Debris:AddItem(Exp, 2)
			TweenService:Create(Exp.PointLight, TweenInfo.new(2), {Range = 0}):Play()
				Exp.FIRE.Enabled = false
				Exp.GLOW.Enabled = false
				Exp.SPECKS.Enabled = false

return FireballMod


can you quickly add some print()s when the client events fire, in order to check if the values are all correct?

I haven’t checked the module yet, but usually this is an error you’d get when handling bad data.


The issue is with requiring the module. Also I forgot to mention that the code works in a solo test but not in a team test. Maybe there is bad data but where would I put the prints?

1 Like

Yes, when a module script encounters an error, then it will say that it experienced an error while loading, and cannot be requested.

Considering that it doesn’t work in team tests, maybe it could be to do with firing the wrong client, or something? Please try to add some print()s to see if we are getting bad data.

for example:

RockEvent.OnClientEvent:Connect(function(plr, MousePos, Speed, Size)
    print(plr, MousePos, Speed, Size)
	StoneMod.BasicAttack(plr, MousePos, Speed, Size)

FireballEvent.OnClientEvent:Connect(function(plr, MousePos, Speed, Size)
    print(plr, MousePos, Speed, Size)
	FireballMod.ShootBall(plr, MousePos, Speed, Size)

Well the script does not continue so the prints you suggested didn’t work, so I added the prints to the server script which fires the data to all clients and the data there is correct.



it may be the function that’s having the issue.
I’ll have a look at it, please give me a little bit.


I’ve had to spoof it a little, but the script works for me?
Double check all of the variables at the top are correctly names, otherwise I’ll try some more things out.


If fire aoe module is under this module, it should work perfectly fine, but if its parent is root script, you will have to consider adding “.Parent” right after script keyword

1 Like

Just made a new module script, copied all the old code and pasted it into a fresh script and it worked! Thanks for the help even if the solution was pretty disappointing.

1 Like

Have you changed the name of module from “FireAOE”, since i think caps make it like this, idk

glad you fixed it eventually.

maybe some properties of the old script were bad? im not sure, I’m just trying to help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.