I am trying to make it so that when a certain task happens, It will tell a local script in starterGUI to perform a task. I want to transport a number value as well.
My initial idea was to start with remote events but they transfer players
The task:
How would I transfer a number value and an on event from Script in workspace to script in starterGUI?
I have a lightning bolt that is created, I want to send a signal to a local script saying a lightning bolt has happened
It will then determine the distance (which I know how to do) and determine if it is either:
Far
Close
RealyClose
This will then determine the sound that will be played in a sound folder I have
Value:
The value will determine if the bolt was positive or negative. This is determined by the value 1 or 2. This will determine the volume of the sounds (Faint or Loud).
How do I tell my local script if there has been a lightning bolt and if it is positive or negative (1 or 2)
There is multiple approaches to this, but if you want to stick to your remote path:
Remote:FireAllClients(StrikePos)
--local Far = 100 -- Not really used, since it's in the "else" statement
local Nearby = 50
local Close = 10
local Camera = workspace.CurrentCamera
Remote.OnClientEvent:Connect(function(StrikePos)
local Distance = (Camera.CFrame.Position - StrikePos).Magnitude
if Distance <= Close then -- Close
print(Distance)
elseif Distance <= Nearby then -- Nearby
print(Distance)
else -- Far
print(Distance)
end
end)