I am trying to enable some particle emitters in a part called ‘VaterTrigger’.
My issue is that my remote event is not firing from the client to the server.
I have tried changing the parameters of the remote events, I have tried changing the name of the parameters and I have double checked the spelling in the script.
I have no idea how to fix this, please help, these are my scripts:
local script (which works absolutely fine):
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character
local UserInputService = game:GetService("UserInputService")
local Dragging = false
local vaterworksgui = plr.PlayerGui["Vaterworks gui"]
local actualpercent = 0
local ReplicatedStorage = game:GetService("ReplicatedStorage")
game:GetService("Workspace").VaterTrigger.ClickDetector.MouseClick:Connect(function()
vaterworksgui.Enabled = true
end)
script.Parent.TextButton.MouseButton1Down:Connect(function()
Dragging = true
end)
-- this is the section with the remote event \/
vaterworksgui.Frame.TextButton.MouseButton1Down:Connect(function()
ReplicatedStorage:FindFirstChild("Vaterworksevent"):FireServer(actualpercent)
vaterworksgui.Enabled = false
print(actualpercent)
end)
-- /\
-- this is my slider gui script which does work (totally not yoinked)
UserInputService.InputChanged:Connect(function()
if Dragging then
local MousePos = UserInputService:GetMouseLocation()+Vector2.new(0,36)
local RelPos = MousePos-script.Parent.AbsolutePosition
local percent = math.clamp(RelPos.X/script.Parent.AbsoluteSize.X,0,1)
script.Parent.TextButton.Position = UDim2.new(percent,0,0.5,0)
vaterworksgui.Frame.Percent.Text = math.round(percent*100)
actualpercent = math.round(percent*100)
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
Dragging = false
end
end)
server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
ReplicatedStorage:FindFirstChild("Vaterworksevent").OnServerEvent:Connect(function(percentage)
print(percentage)
if percentage == Workspace.VaterTrigger.RequiredVater.Value then
print("hmm")
for i,v in pairs(Workspace.VaterTrigger:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Enabled = true
wait(1)
v.Enabled = false
end
end
end
end)
Please help.