Why does my script only work when I am the only person in the server?
Asked by
5 years ago Edited 5 years ago
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:
01 | game.ReplicatedStorage.RemoteEvents 2. Spells.ignis_cast.OnServerEvent:Connect( function (player, position) |
02 | if script.CanFire.Value = = true then |
03 | game.ReplicatedStorage.Debug.Recieve:FireAllClients() |
04 | script.CanFire.Value = false |
05 | game.ReplicatedStorage.RemoteEvents 2. Spells.ignis_cast:FireClient(player) |
07 | local spell = game.ReplicatedStorage.Spells.Ignis [ "Spell-Fire" ] :Clone() |
08 | spell.Parent = game.Workspace.Spells.Ignis |
10 | spell.CFrame = player.Character.RightHand.CFrame |
11 | spell.Transparency = 1 |
12 | spell.Velocity = setMagnitude(player.Character.RightHand.Position, position) |
13 | spell.CanCollide = false |
14 | local bf = Instance.new( "BodyForce" ) |
15 | bf.Force = Vector 3. new( 0 ,game.Workspace.Gravity * spell:GetMass(), 0 ) |
17 | local sh = game.ServerScriptService.Spells.ignisCollision:Clone() |
20 | spell.Player.Value = player.Name |
21 | sh.PlayerFired.Value = player.Name |
23 | script.CanFire.Value = true |
25 | game.ReplicatedStorage.Debug.Fire:FireAllClients() |
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?