generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Mouse Change Error

Previous Thread :: Next Thread 
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 06:20 PM
The clues;

16:19:07.672 - Cannot set Icon of a PlayerMouse
16:19:14.676 - Cannot set Icon of a PlayerMouse
16:19:14.872 - Players.Player1.Backpack.Tool.LocalScript:11: attempt to index global 'Players' (a nil value)

The script;


local mouse = game.Players.LocalPlayer:GetMouse()
local debounce = false
mouse.Button1Down:connect(function()
if debounce == false then
debounce = true
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(7)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
local tool = game:GetService("InsertService"):LoadAsset(56725154)
tool.Parent = Players.Player1.Backpack
debounce = false
end
end)
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 06:20 PM
BTW, keep in mind this is a "LocalScript".
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 06:25 PM
bump
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
12 May 2014 06:26 PM
local mouse = game.Players.LocalPlayer:GetMouse()
local debounce = false
mouse.Button1Down:connect(function()
if debounce == false then
debounce = true
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(7)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
local tool = game:GetService("InsertService"):LoadAsset(56725154)
tool.Parent = game.Players.LocalPlayer.BackPack
debounce = false
end
end)

im going upstairs to get somehting downstairs
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 06:28 PM
@robomax11

Now I get this...

16:27:04.982 - Cannot set Icon of a PlayerMouse
16:27:11.993 - Cannot set Icon of a PlayerMouse
16:27:12.179 - BackPack is not a valid member of Player
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 06:30 PM
bump x2
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 06:37 PM
bumb x3
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
12 May 2014 06:39 PM
You can't change the icon with :GetMouse()
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 06:45 PM
@TheProgrammingMaster
Then how do you ?
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
12 May 2014 06:47 PM
tool.Equipped:connect(function(mouse)
end)
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 06:54 PM
But where do I put it inside the script?
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 07:07 PM
bump x4
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
12 May 2014 07:08 PM
BackPack isn't a valid member of player,
Backpack is.
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
12 May 2014 07:14 PM
It's an event that triggers the function.
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
12 May 2014 07:23 PM
oops

im going upstairs to get somehting downstairs
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 07:24 PM
Okay, the errors are fixed but I cant get the icon to change...

17:23:24.997 - Cannot set Icon of a PlayerMouse
17:23:32.008 - Cannot set Icon of a PlayerMouse
17:23:32.281 - Cannot set Icon of a PlayerMouse


New LocalScript;

tool = script.Parent

local mouse = game.Players.LocalPlayer:GetMouse()
local debounce = false
mouse.Button1Down:connect(function()
if debounce == false then
debounce = true
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(7)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
local tool = game:GetService("InsertService"):LoadAsset(56725154)
tool.Parent = game.Players.LocalPlayer.Backpack
debounce = false
end
tool.Equipped:connect(function(mouse)
end)
end)



Also, I think the "GetService" function isn't working either. Correct me if I am wrong.
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 07:36 PM
bump x5
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
12 May 2014 07:44 PM
Face-palm

The event is when you equipped the tool.
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 07:51 PM
@TheProgrammingMaster

Says the experienced scripting user.

And I'm basically a noob at this so you should expect plentiful of questions...
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 09:23 PM
bump x6
Report Abuse
DataStore is not online. DataStore
Joined: 07 Feb 2012
Total Posts: 8540
12 May 2014 09:52 PM
You've already been told how to fix it. You cannot change the player's mouse icon using the GetMouse method, as someone has pointed out to you twice. The only way, to change a player's mouse icon, is if you use a tool (using the Equipped event) or a hopperbin (using the Selected event).

Tool.Equipped:connect(function(Mouse)
Mouse.Icon = "BlahBlahBlah"
end)
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 10:59 PM
New Error (But Finally I manage to get Icons to change);

20:59:16.835 - Players.Player1.Backpack.Tool.LocalScript:16: ')' expected (to close '(' at line 9) near 'end'

New LocalScript;

tool = script.Parent

local mouse = game.Players.LocalPlayer:GetMouse()
local debounce = false
tool.Equipped:connect(function(Mouse)
Mouse.Icon = "rbxasset://textures\\GunCursor.png"
if debounce == false then
debounce = true
mouse.Button1Down:connect(function()
Mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(7)
Mouse.Icon = "rbxasset://textures\\GunCursor.png"
local tool = game:GetService("InsertService"):LoadAsset(56725154)
tool.Parent = game.Players.LocalPlayer.Backpack
end
end
end)

Report Abuse
DataStore is not online. DataStore
Joined: 07 Feb 2012
Total Posts: 8540
12 May 2014 11:18 PM
end)
end
end)
Report Abuse
THEMENDEZKID is not online. THEMENDEZKID
Joined: 18 Aug 2011
Total Posts: 2401
12 May 2014 11:32 PM
@DataStore

unexpected symbol near ')'

Couldn't you just fix the script by whole? It's the whole point I posted it here.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
12 May 2014 11:34 PM
dude,you DONT ADD 3 ENDS,HE WAS SHOWING WHERE TO CHANGE

gawd...


tool = script.Parent

local mouse = game.Players.LocalPlayer:GetMouse()
local debounce = false
tool.Equipped:connect(function(Mouse)
Mouse.Icon = "rbxasset://textures\\GunCursor.png"
if debounce == false then
debounce = true
mouse.Button1Down:connect(function()
Mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(7)
Mouse.Icon = "rbxasset://textures\\GunCursor.png"
local tool = game:GetService("InsertService"):LoadAsset(56725154)
tool.Parent = game.Players.LocalPlayer.Backpack
end)
end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image