Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Remote Event is not being triggered. Please help, what am I doing wrong?

Asked by 5 years ago
Edited 5 years ago

EVERYTHING IN BOLD FROM HERE ON OUT IS WHERE EVERY SCRIPT IS LOCATED. ABOVE IT IS WHAT TYPE OF SCRIPT IT IS. Alright so, this is suppose to trigger the event and change the pointlights color that is inside parts that is also inside a model. The first script is the one i'm having issues with, its a local script trying to fire server and it won't allow the FireClient or FireAllClients to happen. This script is a local script. game.Workspace.ArenaLights.White

1Power = script.Parent.Power
2--Made By MillerrIAm
3--Helpers Liliardio & WeArefSociety
4--------------------------------------------------------------------
5--Start Script
6function change()
7    game.ReplicatedStorage.LightingEvents.ArenaLightsEvent:FireServer("White")
8end
9script.Disabled = true

This is what is suppose to to call for the script above to work. #2 This is a script, not local or module. game.Workspace.TronsFolder[NewTron].Main[Script|ArenaLights]

01Power = script.Parent.Power
02ArenaLights = game.Workspace.ArenaLights
03--Made By MillerrIAm
04--Helpers Liliardio & WeArefSociety
05--------------------------------------------------------------------
06--Start Script
07Power.Changed:Connect(function(Value)
08    if Value then
09        while Power.Value do
10            ArenaLights.White.Disabled = false
11            wait(0.1)
12            ArenaLights.Blackout.Disabled = false
13            wait(0.1) --Just duplicate this and the line above.
14        end
15    end
16end)

This script works perfectly fine but I figured it could help.#3 This is a script, not a local script or a module script. game.ServerScriptStorage[Scripts|LightingEvents].[Script|ArenaLighting]

01Lighting = game:GetService('Lighting') -- This line isn't needed though.
02ReplicatedStorage = game.ReplicatedStorage
03parts = game.Workspace.ArenaLights:GetChildren()
04--------------------------------
05game.ReplicatedStorage.LightingEvents.ArenaLightsEvent.OnServerEvent:Connect(function(player,arenalight)
06    local children = game.Workspace.ArenaLights:GetChildren()
07    if arenalight == "BrightWhite" then --White Lighting
08      for i, v in pairs(children) do
09        if v:FindFirstChild("PointLight") ~= nil then
10          v.PointLight.Color = Color3.fromRGB(255, 255, 255)
11        end
12      end
13      wait(0.01)
14    elseif arenalight == "White" then
15      for i, v in pairs(children) do
View all 29 lines...

Thank you in advance for any help, comments & answers!

3 answers

Log in to vote
1
Answered by
BuDeep 214 Moderation Voter
5 years ago

The first issue I'm seeing is with your first script being a LocalScript in workspace. The only way a local script will run is if it is a descendant of the following:

-A Player’s Backpack , such as a child of a Tool

-A Player’s Player/Character|character model

-A Player’s PlayerGui

-A Player’s PlayerScripts .

-The ReplicatedFirst service

Now a second issue I'm seeing is you're using Remote Events when their is no communication between the Client and the Server. The solution to this is to use something called "Bindable Events", which excel at server-side communication. Here is a wiki article showing you how to use them:

https://developer.roblox.com/en-us/api-reference/event/BindableEvent/Event

In conclusion, change your local script to a server script, and switch your events to Bindable Events.

0
Don't forget to call your function as well! BuDeep 214 — 5y
Ad
Log in to vote
0
Answered by
Echtic 128
5 years ago

Try deleting the function in the first script, that should do the trick.

0
Function Change()? Just2Terrify 566 — 5y
0
That did nothing. Just2Terrify 566 — 5y
0
then u can try just making the second script local and making it trigger the server event, u don't need 3 scripts for this Echtic 128 — 5y
0
Also since the first script is local it's not working cause it's in workspace, it has to be in the player gui in order to work Echtic 128 — 5y
View all comments (3 more)
0
I'll see if I can. I attempted that and it failed. Do you have discord? I can show you. Just2Terrify 566 — 5y
0
It can still work with 3 scripts u just have to modify them a little, but it would be easier for u if it were just 2 Echtic 128 — 5y
0
MLOH #3697 Echtic 128 — 5y
Log in to vote
0
Answered by 5 years ago

I believe the issue might be that your Change() Function is never being fired. You have set the Function but not called it. Try doing this:

01Power = script.Parent.Power
02--Made By MillerrIAm
03--Helpers Liliardio & WeArefSociety
04--------------------------------------------------------------------
05--Start Script
06function change()
07    game.ReplicatedStorage.LightingEvents.ArenaLightsEvent:FireServer("White")
08end
09 
10change()
11script.Disabled = true

or

1Power = script.Parent.Power
2--Made By MillerrIAm
3--Helpers Liliardio & WeArefSociety
4--------------------------------------------------------------------
5--Start Script
6game.ReplicatedStorage.LightingEvents.ArenaLightsEvent:FireServer("White")
7 
8script.Disabled = true

Other then that, I can't find anything else wrong. Hope this fixes the problem. Best of Luck!

Answer this question