Well I trying to figure it how... I'm really stuck my game need a special mobile button to do something pls help me!
COMMUNITY QUESTION
Context Action Service How to make it work on filtering enabled?
1 answer
The ContextAction:BindAction( string actionName, Function functionToBind, bool createTouchButton, Tuppe inputTypes ) method can only be called from a LocalScript, so your function bound needs to have a FireServer() or InvokeServer() depending if it is a RemoteEvent or RemoteFunction.
Take this code for example:
Server Script:
game.Workspace.RemoteEvent.OnServerEvent:Connect(function(plr)
game.Workspace.Baseplate.BrickColor = BrickColor.Random()
end)
LocalScript:
function changeColor()
game.Workspace.RemoteEvent:FireServer()
end
game:GetService("ContextActionService"):BindAction(
"ChangeColour",
changeColor,
true,
Enum.KeyCode.C
)
This discussion is preserved as it was. New answers, comments, and votes are closed.
