Hi,
I want to fix this Bindable event that doesn’t seem to be detected by other local scripts.
I was making a system where the GUI would move based on what platform you were on - mobile to be specific, to ensure that the GUI wasnt covered by the jump button, etc.
After the player’s console was detected in starterplayerscripts, a bindable event was then sent
(the statement was switched to computer device to make it easier to test)
local UserInputService = game:GetService("UserInputService")
local event = game:GetService("ReplicatedStorage").GUIPlacement.ChangePlacement
if UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled and not UserInputService.MouseEnabled then
print("Mobile device")
elseif not UserInputService.TouchEnabled and UserInputService.KeyboardEnabled and UserInputService.MouseEnabled then
print("Computer device")
event:Fire()
print("FIRED")
elseif UserInputService.TouchEnabled and UserInputService.KeyboardEnabled and UserInputService.MouseEnabled then
print("Computer device with touchscreen")
elseif UserInputService.GamepadEnabled and not UserInputService.KeyboardEnabled and not UserInputService.MouseEnabled then
print("Console device")
end
Then, scripts in starter GUI would detect this bindable event
local event = game:GetService("ReplicatedStorage").GUIPlacement.ChangePlacement
local frame = script.Parent
local buyGemsButton = frame.BuyGems
local timeText = frame.Time
event.Event:Connect(function()
print("I got the event!")
frame.Position = UDim2.new(0.859, 0, 0.103, 0)
buyGemsButton.Position = UDim2.new(-0.03, 0,0.494, 0)
timeText.Position = UDim2.new(0.638, 0,1.155, 0)
end)
However, the message “I got the event” would not print and the GUI would not be relocated.
Here is the location of the bindable event:
I have tried multiple solutions, such as changing location of bindable event, but it doesn’t work.
Any help on how to fix the bindable event is appreciated!