-
What do you want to achieve?
For an event to fire from a LocalScript to a ServerScript. -
What is the issue?
Doesn’t seem to be firing. -
What solutions have you tried so far?
I tried making an event to fire that particular event but it only seems to be affecting the server as a whole not the client (The client can’t see it but the server does.)
Script:
NewEvent.Event:Connect(function()
if db then return end
db = true
local event_index = math.random(#events)
local event = events[event_index]
local event_name = event.name
local event_f = event.f
print("There is a " .. event_name)
event_f()
task.wait(3)
db = false
end)
LocalScript:
function Fixed()
GeneratorPrompt.Triggered:Connect(function()
game.Workspace.Spotlight1.Model.LightC.SpotLight.Enabled = true
game.Workspace.Spotlight1.Model.Model.Light.Material = Enum.Material.Neon
game.Workspace.Spotlight1.Model.Model.Light.Color = Color3.new(0.776471, 0.776471, 0.427451)
game.Workspace.Spotlight2.Model.LightC.SpotLight.Enabled = true
game.Workspace.Spotlight2.Model.Model.Light.Material = Enum.Material.Neon
game.Workspace.Spotlight2.Model.Model.Light.Color = Color3.new(0.776471, 0.776471, 0.427451)
game.Workspace["Guard Booth"].Booth.Industrial_Light.ActualLight.PointLight.Enabled = true
game.Workspace["Guard Booth"].Booth.Industrial_Light.Light.Material = Enum.Material.Neon
game.Workspace["Guard Booth"].Booth.Industrial_Light.Light.Color = Color3.new(0.776471, 0.776471, 0.427451)
game.ReplicatedStorage.Sounds.Restored.Playing = true
NewEvent:Fire()
print("Fixed!")
end)
end
local db = true
local tool = script.Parent
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://14210349342"
local track
UIS.InputBegan:Connect(function(input)
if db == true then
GeneratorPrompt.PromptButtonHoldBegan:Connect(function()
db = false
track = script.Parent.Parent.Humanoid:LoadAnimation(Anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
track:Play()
if track then
wait(2.1)
track:Stop()
db = true
if game.Workspace["Guard Booth"].Booth.Industrial_Light.ActualLight.PointLight.Enabled == false then
Fixed()
end
end
end)
end
end)
I put a debug after the NewEvent:Fire(), it prints but the event doesn’t seem to execute because nothing happens.
I might just be stupid or I just might’ve missed something.
I am aware the my code is a mess, but I’m optimizing it as I go.