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 |
|
|
|
| 06 Jan 2015 05:40 PM |
change if mouse.Icon ~= icon then to
if mouse.Icon then mouse.Icon = icon |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|