#Functions
69 messages · Page 1 of 1 (latest)
yes you can. Simply:
- fire a remote event to the server.
- listen to the event on server and connect it to your function you want to execute on that event.
Bruhh what is this
My clickdetector doesnt detect a mouse click?
local clickdetector = script.Parent.ClickDetector
local event = game:GetService("ServerScriptService").CloseCells
clickdetector.MouseClick(function()
print("Sending signal")
event:FireServer()
end)
doesn't it print?
it actually works in my test
This is a simple fix, just a typo on OP's part
You're missing the :Connect part, @outer stump:
local clickdetector = script.Parent.ClickDetector
local event = game:GetService("ServerScriptService").CloseCells
clickdetector.MouseClick:Connect(function(Player)
print("Sending signal")
event:FireServer()
end)
Yep thats it
how I missed that
o
Same reason people miss semicolons in JavaScript lol, you just assume it's there.
uhm
guys
local clickdetector = script.Parent.ClickDetector
local event = game:GetService("ServerScriptService").CloseCells
clickdetector.MouseClick:Connect(function()
print("Sending signal")
event:FireServer()
end)
``` wheres the typo now...
because
it doesnt work 😅
It's not printing?
still no
RemoteEvent in ServerScriptService
For server-server communication you'll need a BindableEvent, not a RemoteEvent.
RemoteEvents are for client-server and server-client communication.
he probably missed to put the event inside replicated storage
There's not a typo, he's simply using the wrong event.
Assuming he's after server to server communication, he needs to be using a BindableEvent.
but how would a event difference interfere with a print function??
It's not printing?
it wasnt
Oh?
hold on
it should be
Where's the actual script located?
And is it a ServerScript or a LocalScript?
If it's a LocalScript it could be bugging since it can't access ServerScriptService.
so i need to put it in replicatedStorage?
Remove the whole event part, and just ensure the ClickDetector's working.
Depends on whether the script is a LocalScript or a ServerScript.
its a local
BRO
NAHH
local clickdetector = script.Parent.ClickDetector
clickdetector.MouseClick:Connect(function()
print("Sending signal")
end)
NO OUTPUT
That's... weird
Could you show us a screenshot of your Explorer, showing where the ClickDetector & script are?
shouldn't it be normal script?!!!
Works for both.
Are you definitely clicking the button, @outer stump? (Stupid question, I know)
it actually doesn't
tried a local script and doesn't print
Oh, for real?
I'll have to test that out.
....
it prints when its a normal script
LocalScripts don't run in Workspace, oops.
but buttons are in workspace
You're going to need a BindableEvent.
its just intended to control the player
I stand by this comment.
You can use a LocalScript for a ClickDetector, if it's somewhere like StarterPlayerScripts.
last thing and the door should be done,
does anyone maybe know how to make this:
CFrame.new(anchor.Size.X + -0.3,0,-5)
be the opposite of this
CFrame.new(anchor.Size.X + 0.3,0,5)
like the -5 works, but the -0.3 doesnt
it wont go backwards
probably an issue with the 2 symbols (+ and -) at the front, but i dont know how to fix it
Try anchor.Size.X - 0.3?
@outer stump