Why won't my server scripts work in the serverscriptservice???
Asked by
6 years ago Edited 6 years ago
I've been trying to call a remote event, from a tool, through the replicated storage(where the remote event lives) to a script in serverscriptservice, and while it works fine in solo mode, playing in test, and ingame, it wont work! Why is this? I discovered while playing in test some scripts are appearing in serverscriptservice, and others are not, particularly the one i'm trying to call. However, whilst looking through the server window, in test mode, the scripts are in the Scerverscriptservice. I know the answer is staring me straight in the face. Can anyone help?
03 | local wand = script.Parent |
05 | local ArchFolder = wand:WaitForChild( "Effects" ) |
06 | local person = wand.Parent |
07 | local inc = script.Name |
09 | local Power = wand.Power.Value |
16 | for i,p in pairs (game.Players:children()) do |
17 | if (p.Character = = wand.Parent) then |
19 | if (connect ~ = nil ) then connect:disconnect() end |
20 | connect = p.Chatted:connect(PlayerTalked) |
26 | function PlayerTalked(words) |
28 | if (string.find(words:lower(), inc:lower()) ~ = nil ) and (wand.Parent = = owner.Character) then |
29 | print ( "Running ''" ..inc.. "''" ) |
34 | local Fire = game.ReplicatedStorage.Remotes:WaitForChild(script.Name) |
48 | wand.Equipped:connect(Setup) |
the remote function exists in the replicated storage
005 | local Casting = game.ReplicatedStorage.Remotes:WaitForChild(script.Name) |
008 | print ( "seeing if this stupid thing is working" ) |
014 | function CastSpell(Player, wand) |
016 | print ( "Called the remote event" ) |
017 | print (wand.Parent.Name) |
022 | local Energy = Player.PlayerScripts.Energy |
023 | local Progress = Player.PlayerGui.Bar.Frame.Study.Intelligence.Progress |
024 | local Smarts = Player.PlayerGui.Bar.Frame.Study.Intelligence.Smarts |
026 | local ArchFolder = wand:WaitForChild( "Effects" ) |
027 | local person = wand.Parent |
028 | local Power = wand.Power.Value |
031 | wand.CurrentSpell.Value = script.Name |
037 | if (wand.CurrentSpell.Value = = script.Name) and (Energy.Value > = 0 ) then |
039 | Energy.Value = Energy.Value - 20 /(Power/ 2 ) |
043 | Progress.Value = Progress.Value + Smarts.Value |
056 | script.Disabled = false |
057 | local c = wand.Parent.Humanoid:LoadAnimation(wand.SummonSmoke 1 ) |
064 | local r = ArchFolder.Architype:Clone() |
065 | r.Parent = wand.Parent.RightHand |
068 | local L = ArchFolder.Architype:Clone() |
069 | L.Parent = wand.Parent.LeftHand |
074 | local q = Instance.new( "Sound" ) |
081 | q.Parent = game.Workspace |
087 | local p = Instance.new( "Part" ) |
088 | p.formFactor = "Symmetric" |
090 | p.Size = Vector 3. new( 1 , 1 , 1 ) |
091 | p.TopSurface = "Smooth" |
092 | p.BottomSurface = "Smooth" |
098 | ArchFolder.Architype:Clone().Parent = p |
099 | p.Architype.Enabled = true |
100 | ArchFolder.Sparkles:Clone().Parent = p |
101 | p.Sparkles.Enabled = true |
102 | ArchFolder.SpellLight:Clone().Parent = p |
103 | p.SpellLight.Enabled = true |
105 | coroutine.resume(coroutine.create( function () |
111 | script.Disabled = false |
123 | local cf = CFrame.new(wand.Parent.UpperTorso.Position, wand.Parent.Humanoid.TargetPoint) |
124 | local bv = Instance.new( "BodyVelocity" ) |
127 | p.CFrame = cf + cf.lookVector * 4 |
139 | bv.velocity = ((wand.Parent.Humanoid.TargetPoint - p.Position).unit) * 100 |
142 | p.Touched:connect( function (part) |
144 | local nm = p.Architype |
145 | p.Architype.Enabled = false |
146 | p.Architype.Parent = part |
147 | local sm = p.Sparkles |
148 | p.Sparkles.Enabled = false |
149 | p.Sparkles.Parent = part |
150 | local s = Instance.new( "Sound" ) |
180 | Casting.OnServerEvent:connect(CastSpell) |