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

Why does my script only work when I am the only person in the server?

Alright, so here is the problem. When I have more than just me any server, the projectile does not appear. I have tested this, and AS SOON as they join, it stops firing. Here is the script I am having problems with:

game.ReplicatedStorage.RemoteEvents2.Spells.ignis_cast.OnServerEvent:Connect(function(player, position)
		if script.CanFire.Value == true then -- 2 second delay between casting spell
			game.ReplicatedStorage.Debug.Recieve:FireAllClients()
			script.CanFire.Value = false
			game.ReplicatedStorage.RemoteEvents2.Spells.ignis_cast:FireClient(player)
			timer = os.time()
			local spell = game.ReplicatedStorage.Spells.Ignis["Spell-Fire"]:Clone()
			spell.Parent = game.Workspace.Spells.Ignis
			spell.Name = "Ignis"
			spell.CFrame = player.Character.RightHand.CFrame
			spell.Transparency = 1
			spell.Velocity = setMagnitude(player.Character.RightHand.Position, position)
			spell.CanCollide = false -- Collision will be done a different way (effect added, part removed)
			local bf = Instance.new("BodyForce")
			bf.Force = Vector3.new(0,game.Workspace.Gravity * spell:GetMass(),0)
			bf.Parent = spell
			local sh = game.ServerScriptService.Spells.ignisCollision:Clone()
			sh.Parent = spell
			sh.Disabled = false
			spell.Player.Value = player.Name -- Set the value for who fired the spell
			sh.PlayerFired.Value = player.Name
			wait(2)
			script.CanFire.Value = true
		else
			game.ReplicatedStorage.Debug.Fire:FireAllClients()
		end
	end)

I am using ScreenGuis to test that the remote event is firing, and it returns that the event is being fired when it is supposed to be, but nothing is appearing in terms of the projectile.

This is a SERVER script, and "CanFire.Value" is set to true when the player is supposed to fire. It is also changed to false when the player clicks at the appropriate time.

This makes it frustration as in my view, my script should work.

Here is video proof:

Google Drive MP4

Link Address: https://drive.google.com/file/d/1SBX9ac24MRz8njstJ45fdHURuqwL7AFp/view?usp=sharing

Any ideas?

3 comments

1

It does work when I am the only one in the server.

0

Do you know at exactly what line it breaks? Are you sure the ignis_cast is being fired correctly?

0

Sorry didn't read the bottom part.

1 answer

✓ Accepted answer

Looks like it is / was a bug or something, but I'm kinda new so idk if that is 100%

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