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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Easy script help[no error]

Previous Thread :: Next Thread 
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
06 Jan 2015 05:35 PM
script.Parent.Touched:connect(function(player)
if player:FindFirstChild("Humanoid") then
local mouse = game.Players.LocalPlayer:GetMouse()
local icon = "http://www.roblox.com/asset/?id=34615348"
if mouse.Icon ~= icon then
mouse.Icon = icon
end
end
end)


R$959
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
06 Jan 2015 05:40 PM
change if mouse.Icon ~= icon then to

if mouse.Icon then
mouse.Icon = icon
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
06 Jan 2015 05:41 PM
Im assuming your script is in workspace since you did script.Parent.Touched

local mouse = game.Players.LocalPlayer:GetMouse()
Can only be used in local scripts

Local scripts don't work in workspace
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
06 Jan 2015 05:51 PM
@128
It's a localscript in the brick
@lil I'll try it thanks


R$959
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
06 Jan 2015 05:54 PM
doesn't work lil


R$959
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
06 Jan 2015 05:54 PM
@Lil that doesn't help, that only makes it worse, since checking for a property on a Roblox data type will error and break the script. So just remove it entirely.

@025110 you can't use LocalScripts in Workspace, as 128GB said. And you cannot use GetMouse in a Script, so you need RemoteEvents or RemoteFunctions for this.
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
06 Jan 2015 05:54 PM
You can't have local scripts in parts in workspace >.<
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
06 Jan 2015 05:56 PM
"checking for a property on a Roblox data type will error and break the script. So just remove it entirely."

I mean if the property is nil. So there really is no reason to do that unless the property exists but the value is nil (Which it will never be in this case) or if it is a boolean (Which it will never be in this case).
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
06 Jan 2015 05:56 PM
if I put the localscript in startergui and use game.Workspace.Part will that work?


R$959
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
06 Jan 2015 06:45 PM
Nope... You could just put the script in a button then change the function to

script.Parent.MouseButton1Click:connect(function() and that would work.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
06 Jan 2015 06:46 PM
'if I put the localscript in startergui and use game.Workspace.Part will that work? '
It should
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
06 Jan 2015 06:51 PM
I looked at the script and actually no,
This is how you should write it


local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
workspace.Part.Touched:connect(function(part)
if (game.Players:GetPlayerFromCharacter(part.Parent) == player) then
mouse.Icon = "rbxassetid://34615348"
end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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