Aloha developers. I am having some troubles with custom prompts on mobile.
The custom prompts have ClickablePrompt set to true. These prompts are created via a script for a weapon spawner every time a new weapon generates. Here is the entire code on the server side:
local function WeaponAdded()
local prompt = Instance.new("ProximityPrompt")
prompt.Parent = script.Parent
prompt.Style = Enum.ProximityPromptStyle.Custom
prompt.GamepadKeyCode = Enum.KeyCode.ButtonY
print(prompt.ClickablePrompt)
for i, v in pairs(script.PromptFolder:GetChildren()) do
local newChild = v:Clone()
newChild.Parent = prompt
end
local weaponsFolder = game.ReplicatedStorage.Gamemodes:WaitForChild("Mode").Weapons
local chosenWeapon = math.random(1, #weaponsFolder:GetChildren())
for i, v in pairs(weaponsFolder:GetChildren()) do
if i == chosenWeapon then
prompt.WeaponDisplayName.Value = v.DisplayName.Value
prompt.WeaponName.Value = v.Name
local showcaseModel = v.Handle[v.Name].WeaponModel:Clone()
showcaseModel.Parent = script.Parent
end
end
prompt.ActivationScript.Disabled = false
end
script.Parent.WeaponState.Changed:Connect(function()
if script.Parent.WeaponState.Value == true then
WeaponAdded()
elseif script.Parent.WeaponState.Value == false then
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("ProximityPrompt") or v:IsA("Model") then
v:Destroy()
end
end
wait(10)
script.Parent.WeaponState.Value = true
end
end)
script.Parent.WeaponState.Value = true
Now, this is the code on the client side:
local proximityPromptService = game:GetService("ProximityPromptService")
local tweenService = game:GetService("TweenService")
proximityPromptService.PromptShown:Connect(function(prompt, inputType)
local check = prompt.Parent:FindFirstChild("Prompt")
if check == nil then
local proximityPrompt = script.Prompt:Clone()
proximityPrompt.Frame.ItemName.Text = prompt.WeaponDisplayName.Value
if inputType == Enum.ProximityPromptInputType.Gamepad then
proximityPrompt.Frame.KeyText.Text = "Y"
elseif inputType == Enum.ProximityPromptInputType.Keyboard then
proximityPrompt.Frame.KeyText.Text = "E"
elseif inputType == Enum.ProximityPromptInputType.Touch then
proximityPrompt.Frame.KeyText.Text = "TAP"
end
proximityPrompt.Size = UDim2.fromScale(0.03,0.02)
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Circular, Enum.EasingDirection.Out, 0, false, 0)
local goal = {}
goal.Size = UDim2.fromScale(3,2)
local tween = tweenService:Create(proximityPrompt, tweenInfo, goal)
proximityPrompt.Parent = prompt.Parent
tween:Play()
end
end)
proximityPromptService.PromptHidden:Connect(function(prompt, inputType)
local proximityPrompt = prompt.Parent:FindFirstChild("Prompt")
if proximityPrompt then
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Circular, Enum.EasingDirection.Out, 0, false, 0)
local goal = {}
goal.Size = UDim2.fromScale(0.03,0.02)
local tween = tweenService:Create(proximityPrompt, tweenInfo, goal)
tween:Play()
tween.Completed:Wait()
proximityPrompt:Destroy()
end
end)
proximityPromptService.PromptTriggered:Connect(function(prompt, inputType)
local proximityPrompt = prompt.Parent:FindFirstChild("Prompt")
if proximityPrompt then
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Circular, Enum.EasingDirection.Out, 0, false, 0)
local goal = {}
goal.Size = UDim2.fromScale(0.03,0.02)
local tween = tweenService:Create(proximityPrompt, tweenInfo, goal)
tween:Play()
tween.Completed:Wait()
proximityPrompt:Destroy()
end
end)
Clearly prompts should be able to be clicked, correct? The answer is no though, I guess? The prompt does not tween out like it should when clicked on mobile, and the player is not given a weapon. I can not figure this out despite all the troubleshooting I have done. No errors appear on the client nor server console.
So, what’s the issue y’all? Where did I go wrong?
EDIT: I should clarify that the prompt has no issue appearing on mobile, but the player can not interact with it.