Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

:GetMouse() is a nil value?

script is inside the playergui

Mouse = script.Parent.Parent:GetMouse()

it says "Mouse" is a nil value i used this script back in the day but now it doesnt work any help? plz

5 comments

0

this is a "script"

0

only a local script can access the players mouse.

0

ohhhhhh

0

im so stupid Thnx

0

can u write that in the "Answer this question" section so that i can reward u with 1+ point

3 answers

✓ Accepted answer

Write this code in a LocalScript and put that inside StarterGui or wherever it can run.

-- LocalScript.

local Plr = game:GetService("Players").LocalPlayer
local Mouse = Plr:GetMouse()

Switch the script to a 'LocalScript' and you can write

local mouse = script.Parent.Parent:GetMouse()

or to be exact more specific

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Mouse = game.Players.LocalPlayer:GetMouse()

USE A LOCAL SCRIPT IN STARTER GUI ONLY unless you know what your doing

1 comment

0

Yeah Sorry Forgot

This discussion is preserved as it was. New answers, comments, and votes are closed.