Hey, I'm trying to make the server send messages to the server via a remote event but either the event isn't firing properly or it isn't being caught. Why isn't this working and is there a way to modify this?
The left script is the child of the trigger that sends the event on touch (Child to Trigger)
script.parent is the trigger that's supposed to send the event on touch (In Workspace)
ChatThingy is the remote event (In ReplicatedStorage)
The right script is a local script that tries to catch the message to send the messages (In sterterGUI)
If there are any questions lmk
#Why isn't this code working?
1 messages · Page 1 of 1 (latest)
local scripts are meant for the client so something like on server event doesn't work
on server event is meant for the server and server side scripts
So do I change that to a regular script?
yes
but before you do that if the touched event for the part is in a server script then don't bother creating a remote event
either make a bindable or copy and paste the on server event code into the touched event
you can only fire server from the client
What's a bindable
bindable event basically it allows for server to server or client to client communication so you can have a sever side script that fires it and another that connects the event to some function but you can't do it between server and client because remote events are used for that
** You are now Level 4! **
Is workspace client or server?
Yo
both
Watch Alvin blox’s whole tutorial series
but for storage usually use replicated storage (that's client and server)
brawl dev also good
that's how I learned but I also had previous experience in python
I'm not trying to dedicate all that, I'm just trying to do one thing then move on to the next.
Also I am fairly fluent in Lua
Okay skid
Ohh just normal
Who?
So you just don’t know the Roblox things
Yeah
You don’t know how server / client stuff works?
I understand it runs on LuaU, which is a branch of Lua, I just don't entirely know the difference
Yea
That's the tutorial I was following for this
fireserver() is on the client
fireclient() is on the server
onserverevent() is on the server
onclientevent() is on the client
Server changes replicate to all client
If a visual change occurs on the client it’s only for that client.
If the server changes:
replicated storage
workspace
lighting
… a lot more
It’s going to replicate to every client.
But if the client changes those things, it’s only going to appear for that client
Some things are only visible to one side, for example Serverstorage and ServerScriptService is only visible to the server for security reasons.
StarterPlayer is only visible and accessible on the client
For server and client to communicate you use remote events and remote functions.
Remote events are one way triggers from server to client or other way around
Bindable events are like remote events but they’re supposed to be used on one side only for communication between scripts
Remote functions are like remote events but they give feedback. For example a remote function firing the client to give the mouse position and the client gives the mouse position back to the server (unsafe)
Wyd
I didn’t read ur post
This doesn’t work?
Print on both triggers and send me a picture of replicated storage
Oh yeah just do this?
No it's in a regular script now
Yeah
Still doesn’t work?
so it should work then
It's saying FireServer only happens on client
Huh
The place where you fire server should be a client script
Not server script
this needs to be a localscript
if the touched event is happening on the server then just grab the code from the on server event script and paste it into the touched event
Yeah you could do all of it on client
No, the chat messages part can only happen on a server script
so whats the issue right now
Does ur script work yet
No
ddi you turn this into a serverscript
Takes pictures of your serverscriptservice starterplayer and replicated storage
All expanded out
Either I messed up the touch sensing part or the function isn't happening
ServerScript is a regular script right?
yes
Yes
i shouldve made that clear
try replacing touched event like this
trigger.Touched:Connect(function()
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("Test")
end)
Where is the local script
Bruh
It’s because
U have a local script in workspace
You can’t do that
Can you?
you can if you change the context
This is why pictures r needed
better to put it in starterplayer anyways
It isn't properly registering that it's being touched
** You are now Level 5! **
Even with this code
Did u already do what he said
Do I just put the part in StarterPlayer?
what kind of script is it for the touched event server (script) or client (localscript)
😭
Client
His script for that is under the part
So move the script into starterplayer
ok now copy and paste the code from that script
Reference the part from workspace
and put inside a server script
Ohhhhh
yall gonna confuse the guy
Yeah what
but keep the server script in workspace or server script service (preferably)
Just move the client script gng
That’s all
Client scripts don’t run under workspace
Unless you do that context thing or wtv
But might as well have it in the right spot
actually the server script would need to be a child of that part because the reference to the part is script.Parent
I just changed it to Game.Workspace.ChatTrigger
Now I can only assume that it isn't registering that it's touched
The first image is of the output
No the door script is completely unrelated to this
I'm just showing that it isn't doing anything
i think i figured out what you need to do
put a local script in starter character scripts
then do the following in the script
local TextChatService = game:GetService("TextChatService")
local trigger = workspace:WaitForChild("ChatTrigger")
trigger.Touched:Connect(function()
local robloxGeneral : TextChannel = TextChatService.TextChannels.RBXGeneral
robloxGeneral:DisplaySystemMessage("message")
end)
Do I delete the other stuff?
You can store server-sided scripts in the workspace, but you can store localscripts into it.
I don’t recommend storing any scripts into the workspace