MouseConnection = Mouse:GetPropertyChangedSignal("Target"):Connect(function()
print("HI")
end)
while wait(1) do print(Mouse.Target) end
HI
is never printed, but each second something different is printed from line 4
, any idea why?
Not sure if it’s relevant but I’ve messed with mouse settings to disable the cursor.
Full Script
--// BedroomA.lua // SetAsync. // Module to be called from client.
return function()
local Player = game:GetService("Players").LocalPlayer
local UserInputService = game:GetService("UserInputService")
-- [1] - Wait for introduction screen.
local Loading = Player.PlayerGui.Introduction
if Loading.Enabled then
Loading:GetPropertyChangedSignal("Enabled"):Wait()
end
-- [2] - Turn on the PC.
local Hint = Player.PlayerGui.Hint.Main
Hint.Text.Text = "Turn on your computer."
Hint.Visible = true
local Billboard = Player.PlayerGui.Prompt
local Mouse = Player:GetMouse()
local MouseConnection, UISConnection, PromptActive, Next
MouseConnection = Mouse:GetPropertyChangedSignal("Target"):Connect(function()
print("HI")
--PromptActive = (Mouse.Target.Name == "PCPromptPart")
--print(PromptActive)
--if PromptActive then
-- Billboard.TextLabel.Text = "E - Turn on"
-- Billboard.Enabled = true
-- Billboard.Adornee = Mouse.Target
--else
-- Billboard.Adornee = nil
-- Billboard.Enabled = false
--end
end)
while wait(1) do print(Mouse.Target) end
UISConnection = UserInputService.InputBegan:Connect(function(KeyCode, GameProcess)
if PromptActive then
if not GameProcess then
if KeyCode == Enum.KeyCode.E then
--MouseConnection:Disconnect()
--UISConnection:Disconnect()
--Next()
end
end
end
end)
function Next()
Hint.Visible = false
end
end