Hello!
I’m attempting to make an obstacle for an ‘obby’ game. It’s a door which displays a question, and the player has to type the correct answer in the TextBox in order to go through. It works on the computer (in Studio and on Roblox itself), but It doesn’t work on Mobile. I tried looking on the API Reference and the DevForum, but to no avail.
Here’s the door and its descendants in Workspace.
The script I created for the door is a LocalScript which I placed inside of StarterCharacterScripts.
-- This script uses CollectionService and tags.
local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")
local tagged = CollectionService:GetTagged("Arithmetic")
local transparency = {Transparency = 1}
local tweenInfo = TweenInfo.new(0.5)
wait(10) -- I couldn't get the script to work every time without yielding.
for _, part in tagged do
local surfaceGui = part:WaitForChild("Equation")
local frame = surfaceGui.EquationFrame
local textBox = frame.Answer
local intValue = part.Ans
local tween = TweenService:Create(part, tweenInfo, transparency)
textBox.InputChanged:Connect(function()
local newText = textBox.Text
if newText == intValue.Value then
print("The answer was correct.")
surfaceGui.Enabled = false
tween:Play()
wait(0.1)
part.CanCollide = false
part:Destroy()
end
end)
end
I can’t seem to figure this one out, although I think it has something to do with the event I used(?).