I tried to make a script using context action service, but the function has a parameter, is there a way to get around this?
function openPhone(player) -- This is the function that will run
local playerGui = player:WaitForChild("PlayerGui")
local frame = playerGui.PhoneMenuGui.MainFrame
frame:TweenPosition(
UDim2.new(-0, 0, 0.262, 0), -- End position
"Out", -- Easing direction
"Bounce", -- Easing style
1, -- Time in seconds
false, -- Overide other tweens
print("Phone opened"),
chooseGradient(player)
)
end
game.Players.PlayerAdded:Connect(function(player)
local localPlayer = player
if UserInputService.KeyboardEnabled then
ContextActionService:BindAction("openAndTweenPhone", openPhone(localPlayer), false, "p")
end
end)

1 comment
https://developer.roblox.com/en-us/api-reference/function/ContextActionService/BindAction openPhone() will receive at least 3 parameters,try openPhone(a,b,c,d) print(a) print(b) print(c) print(d) end to see how it works