This works find in studio but doesnt in game. I jsut got into filtering enabled and im confused, I followed the wiki and follow youtube videos but it doesnt make sense as to why this isnt working.
This is the script I put in start character (its a local script) ~~~~~~~~~~~~~~~~~
workspace.button5.ClickDetector.MouseClick:connect(function() local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
ReplicatedStorage.Open:invokeServer()
end)
This is the second script thats in server script service ~~~~~~~~~~~~~~~~~ ReplicatedStorage = game:WaitForChild("ReplicatedStorage") local function gui(player) player.PlayerGui.ok.Frame.Visible = true end ReplicatedStorage.Open.OnServerInvoke = gui
Now in studio it works, but in game it doesnt, It says that it isnt a member of the player Gui, I even tried printing the gui in game using the devleoper tab and it wouldnt print it. When I did a WaitForChild() command for the gui, it said "possible for infinite" which is saying it may go on forever waiting, which it does because it doesnt work.
Problem | Solution |
---|---|
You're using a RemoteFunction and not returning anything |
Use a RemoteEvent instead |
You're modifying PlayerGui from the server | Modify from client instead |
You're handling MouseClick on the client |
Handle on the server |
-- LocalScript under ok.Frame local ReplicatedStorage = game:GetService("ReplicatedStorage") local OpenGui = ReplicatedStorage:WaitForChild("Open") OpenGui.OnClientEvent:Connect(function() script.Parent.Visible = true end)
………
-- Server Script under button5 local ReplicatedStorage = game:GetService("ReplicatedStorage") local OpenGui = ReplicatedStorage:WaitForChild("Open") script.Parent.ClickDetector.MouseClick:Connect(function(plr) OpenGui:FireClient(plr) end)
RemoteFunction
if you want to return something, such as the price of a car in game. Use a RemoteEvent
if you want to do something such as spawning a car.