So my GUI:
I have a mission popup GUI. With an accept and decline button. If the mission is accepted, then I check if the mission can be accepted (I have a max limit of 3 missions at a time)
So originally I did this all via LocalScript, but I kinda realized now that I assume hackers can mess with this.
So I upon clicking the button sent a remote event client - server which in the server script checks if the mission can be done. And then I also was going to do all the GUI code there. But I guess GUI’s can’t be altered on a server script? Since now my script isn’t working.
So I tried to send a server → client event back to the original local script to deal with the GUI changing stuff.
This is my server script
function serverToClient()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvents").RE3
remoteEvent:FireClient(true)
end
And then my local script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvents").RE3
local function missionAccepted(status)
if status == true then
print("Can do mission")
end
end
remoteEvent.OnClientEvent:Connect(missionAccepted)
I’m getting this error: Unable to cast value to Object - Server - ServerScript:16
So I guess I can’t just pass a value it has to be an object, in my case I just want to pass a boolean to tell if the mission can be done or not. How would I go about doing this?
The goal is just to make sure that you can do the mission, to avoid hackers. So if there is a better way to do this please help! Thanks.