So, I want to call a MouseButton1Click event from a gui from a script in the Server Script Service but the script I've tried doesn't work. Is there a way that you can call MouseButton1Down from a script in SSS? Here's my script:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local EV = ReplicatedStorage:WaitForChild("Events") local StarterGui = game:GetService("StarterGui") local Persona = StarterGui.ChoosePersonality.PersonaFrame local Channel = StarterGui.ChooseChannel.ChannelFrame local CM = EV:WaitForChild("ChoseMny") local CS = EV:WaitForChild("ChoseSmart") local TK = EV:WaitForChild("ChoseTlk") local OT = EV:WaitForChild("ChoseOutgng") function mnyClick() Persona:Destroy() Channel.Visible = true end Persona.mnyhngry.MouseButton1Click:connect(mnyClick)
MouseButton1Click
cannot be listened for from the server. Heck the server shouldn't have any business in GUIs anyways. Simply use a LocalScript
. Also, the GUIs themselves are inside the PlayerGui
, not the StarterGui
. StarterGui
is basically what the PlayerGui
clones out of, so the GUIs, any running LocalScript
s in there are in PlayerGui
.-- localscript under mnyhungry local player = game:GetService("Players").LocalPlayer -- player local playerGui = player:WaitForChild("PlayerGui") script.Parent.Activated:Connect(function() playerGui.ChoosePersonality.PersonaFrame:Destroy() playerGui.ChooseChannel.ChannelFrame.Visible = true end)
:connect()
with a lowercase c is deprecated, use :Connect()
with an uppercase C.Server Script Service is server side and cannot modify player's gui. Gui interactions like MouseButton1Click
must be called from a LocalScript.