make sure the event is a remoteevent, not remotefunction
Nope, thatâs completely incorrect, What he did was correct, .OnClientEvent
does not take either the player or the server as a parameter.
Where is your LocalScript
located?
Local script has the error.just that i dont know why the OP could not find it
Can u look at this for reference
Why is the server varaible not define???
(IN YOUR LOCAL SCRIPT)
It should be local Server = your remote event
Server.OnClientEvent:Connect(function())
End
Maybe try this?
local Event = game.ReplicatedStorage.NotifFolder["Server-Local Notifs"]
game.Players.PlayerAdded:Connect(function(a)
a.Chatted:Connect(function(b)
if b:lower():find("fart") then
Event:FireClient(a, "Head", "Body", "no")
print("sdffsdfdfs")
end
end)
end)
I also had this issue. Where is your server script located? And your local script?
is that a local script in workspace?
Yesterday someone told me that Local Scripts donât work in Workspace.
Indeed, LocalScripts
donât run in Workspace
, aswell as ReplicatedStorage
, ServerStorage
, ServerScriptService
, StarterPlayer
(not as a child, but in StarterPlayerScripts
and StarterCharacterScripts
, it would run), Players
(runs as a child of a Playerâs 'PlayerScripts`), etc.
Honestly, if the script doesnt work because is it outside of the serverscriptservice?
The Script if you are firing a client or allclients, the script only works on the serverscriptservice so you have to do that
Server-scripts
are not limited to ServerScriptService
, they can run in Workspace
but itâs less reliable.
im talking about remote events not that and i know scripts can run in workspace
This is a local script, correct?
sorry, i fell asleep, to answer all the questions;
1 sending script is a script, reciving is a local
2 server script is in serverscriptservice
3 local script is in starter gui > my gui
4 it is a remote event
5 for the last time, the print in th sending script works, so i know its trying to fire the event
âŚhave you tried my idea then? It could be that the if statement is bugged?
Can you show the entirety of both scripts? It would be helpful if I could see what the contents inside both scripts are, so I can try and figure out what your issue is.
Is the Server Variable the correct RemoteEvent?
already showed the entirety of the first script, heres the rest of the second one:
-- Getting Values From RS --
local Local = game.ReplicatedStorage:WaitForChild("NotifFolder"):WaitForChild("Local-Local Notifs")
local Server = game.ReplicatedStorage:WaitForChild("NotifFolder"):WaitForChild("Server-Local Notifs")
local Settings = game.ReplicatedStorage:WaitForChild("NotifFolder"):WaitForChild("Settings")
-- Getting Settings From RS --
local Enabled = Settings.Enabled
local Animated = Settings.Animated
local Pos = Settings["Pos (left, right)"]
-- Getting servies --
local Tween = game:GetService("TweenService")
-- Getting UI --
local NotifMain = script.Parent.Notif
local Head = NotifMain.Head
local Body = NotifMain.Body
local OptinalButt = NotifMain.OptinalButton
local TEMP = script.Parent.TEMP
local Que = script.Parent.Notif.Que
-- Local functions --
local function AddToQue(Headtxt, Bodytxt, ButtonEnabled)
print("Added to que")
local NewQueVals = TEMP.Qued:Clone()
if Headtxt ~= nil then
NewQueVals.Head.Value = Headtxt
else
NewQueVals.Head.Value = "Unable to load STRING"
end
if Bodytxt ~= nil then
NewQueVals.Body.Value = Bodytxt
else
NewQueVals.Body.Value = "Unable to load STRING"
end
NewQueVals.Button.Value = ButtonEnabled
end
local function MakeNewNotif(Headtxt, Bodytxt, ButtonOn)
NotifMain.Visible = true
Head.Text = Headtxt
Body.Text = Bodytxt
if ButtonOn == true then
OptinalButt.Visible = true
else
OptinalButt.Visible = false
end
task.wait(3)
NotifMain.Visible = false
end
-- Script --
Server.OnClientEvent:Connect(function(HeadText, BodyText, ButtonOn)
print("Recived")
local ButOn = nil
string.lower(ButtonOn)
if ButtonOn == "yes" then
ButOn = true
elseif ButtonOn == "no" then
ButOn = false
end
AddToQue(HeadText, BodyText, ButOn)
end)
Local.Event:Connect(function(HeadText, BodyText, ButtonOn)
local ButOn = nil
string.lower(ButtonOn)
if ButtonOn == "yes" then
ButOn = true
elseif ButtonOn == "no" then
ButOn = false
end
AddToQue(HeadText, BodyText, ButOn)
end)
Que.ChildAdded:Connect(function(Child)
local Hed = nil
local Bod = nil
local But = nil
if Child:IsA("Folder") and Child.Name == "Qued" then
for _, V in pairs(Child:GetChildren()) do
if V:IsA("StringValue") then
if V.Name == "Body" then
Bod = V.Value
elseif V.Name == "Head" then
Hed = V.Value
end
elseif V:IsA("BoolValue") then
if V.Name == "Button" then
But = V.Value
end
end
end
end
MakeNewNotif(Hed, Bod, But)
task.wait(3.5)
end)
This is for a quable notif system i was making for fun
For the string.lower(ButtonOn)
, you should replace it with ButtonOn = string.lower(ButtonOn)