Show mouse script

Hello! So I have a script where the mouse is gone for when the game starts. and i have another script to show the mouse though its not showing? am not sure if am missing something

localscript:

local value = game.Players.LocalPlayer:WaitForChild("Lives")
local text = script.Parent.TextLabel
text.Text = value.Value
local txtButton = Instance.new("TextButton")
txtButton.BackgroundTransparency = 1
txtButton.Text = ""
local plrGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local screengui = Instance.new("ScreenGui", plrGui)
screengui.Name = "MoveMouse"
txtButton.Size = UDim2.new(0, 0, 0, 0)
txtButton.Parent = screengui
txtButton.Modal = false

value.Changed:Connect(function(__NEWVAL)
	if __NEWVAL == 0 then
		txtButton.Modal = true
		local Mouse = game.Players.LocalPlayer:GetMouse()
		script.Parent.Frame.Visible = true
		script["nightmares jumpscare fnaf"]:Play()
		Mouse.Icon = "rbxasset://10088146939"
	else
		game.Players.RespawnTime = 100000000 -- gets player ready
		script.Parent.TextLabel.Visible = true
		game.ReplicatedStorage.RemoteEvents.Respawn:FireServer()
		txtButton.Modal = false
		wait(3)
		script.SpawnSound:Play()
		text.Text = "You have "..__NEWVAL.." Life left. Dont waste them."-- __newval is just new the value that has been changed to.
		game.Players.LocalPlayer.PlayerGui.Intro.MouseIcon.Visible = true
		local Camera = game.Workspace.Camera
		Camera.CameraType = Enum.CameraType.Custom
		game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 11
		game.Players.LocalPlayer.Character.Humanoid.JumpPower = 0
		wait(5)
		script.Parent.TextLabel.Visible = false
		game.Players.LocalPlayer.Character.Respawn:Play()
	end
end)

script.Parent.Frame.Lobby.MouseButton1Click:Connect(function()
	game:GetService("TeleportService"):Teleport(test, game.Players.LocalPlayer)
	script.Parent.Frame.TryAgainButton.Visible = false
	script.Parent.Frame.Lobby.Visible = false
	script.Parent.Frame.TextLabel.Visible = false
end)

your trying to hide the mouse icon then show it again?

yea. The mouse was hidden before now I want it to show when this script runs

you need to reference the .value inside the changed function

if value.Value == 0 then -- need to use your value and reference the value here

Also you can use this to disable and enable the mouse icon easily

local UserInputService = game:GetService('UserInputService')

UserInputService.MouseIconEnabled = false   -- use this to disable it

UserInputService.MouseIconEnabled = true   -- use this to reenable it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.