#Functions

69 messages · Page 1 of 1 (latest)

eager arch
#

think you can do that using remote events

stark ruin
#

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.
outer stump
#

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)
stark ruin
#

doesn't it print?

outer stump
#

ill try to switch to a proximity button

stark ruin
#

it actually works in my test

regal fulcrum
#

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)
outer stump
#

o

regal fulcrum
outer stump
#

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 😅

regal fulcrum
#

It's not printing?

outer stump
#

still no

regal fulcrum
#

That's weird, but I have an idea.

#

Is "event" a BindableEvent, or a RemoteEvent?

outer stump
#

RemoteEvent in ServerScriptService

stark ruin
regal fulcrum
#

For server-server communication you'll need a BindableEvent, not a RemoteEvent.

#

RemoteEvents are for client-server and server-client communication.

stark ruin
#

he probably missed to put the event inside replicated storage

regal fulcrum
#

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.

outer stump
#

but how would a event difference interfere with a print function??

regal fulcrum
#

It's not printing?

outer stump
#

it wasnt

regal fulcrum
#

Oh?

outer stump
#

hold on

stark ruin
#

it should be

regal fulcrum
#

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.

outer stump
#

so i need to put it in replicatedStorage?

regal fulcrum
#

Remove the whole event part, and just ensure the ClickDetector's working.

regal fulcrum
outer stump
#

its a local

#

BRO

#

NAHH

#
local clickdetector = script.Parent.ClickDetector

clickdetector.MouseClick:Connect(function()
    print("Sending signal")
end)

NO OUTPUT

regal fulcrum
#

That's... weird

#

Could you show us a screenshot of your Explorer, showing where the ClickDetector & script are?

outer stump
stark ruin
regal fulcrum
#

Are you definitely clicking the button, @outer stump? (Stupid question, I know)

stark ruin
#

tried a local script and doesn't print

regal fulcrum
#

Oh, for real?

regal fulcrum
#

I'll have to test that out.

outer stump
#

oh yea

#

a normal script did it

stark ruin
#

....

outer stump
#

it prints when its a normal script

regal fulcrum
#

LocalScripts don't run in Workspace, oops.

outer stump
regal fulcrum
stark ruin
regal fulcrum
outer stump
#

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

regal fulcrum
#

Try anchor.Size.X - 0.3?
@outer stump