|
| 21 Aug 2015 09:32 PM |
How would I make it so that when the mouse goes over a block a little gui pops up. I made this but it doesn't work.
local player = game.Players.LocalPlayer local mouse = player:GetMouse()
if mouse.Target == script.parent then local gui = Instance.new("ScreenGui", player.PlayerGui) local txt = Instance.new("TextLabel", gui) txt.Text = "Testing" txt.BackgroundColor = Color3.new(0,0,0) txt.BackgroundTransparency = .5 txt.TextColor = Color3.new(255,255,255) end |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 21 Aug 2015 09:38 PM |
I believe it needs to be in a local script in the player not a normal script in the brick,
I am a noob so don't listen to me as a god and I may be wrong |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2015 09:40 PM |
| Hmm, I don't think so as the wiki says "The object that the mouse is pointing to." But then again I'm asking here because I don't understand the wiki. |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 21 Aug 2015 09:43 PM |
Would you mind trying altering the script and putting it in the starter pack?
I've done it before with a keypressed script and it needed to be in the player and in a local script because it was calling upon a local function (the players mouse over) |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2015 09:46 PM |
I moved it to Starterplayer like you said and did this, but it still doesn't work.
local player = game.Players.LocalPlayer local mouse = player:GetMouse()
if mouse.Target == workspace.Part then --local gui = Instance.new("ScreenGui", player.PlayerGui) --local txt = Instance.new("TextLabel", gui) --txt.Text = "Testing" --txt.BackgroundColor = Color3.new(0,0,0) --txt.BackgroundTransparency = .5 --txt.TextColor = Color3.new(255,255,255) print('found') end |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 21 Aug 2015 09:48 PM |
local Mouse = game.Players.LocalPlayer:GetMouse() Mouse.Changed:connect(function(p) if p == "Target" then --change this to ur brick name print("hi") end end)
|
|
|
| Report Abuse |
|
|
|
| 21 Aug 2015 09:55 PM |
| Nope and it's in a local script in StarterPlayer. |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2015 10:00 PM |
StarterPack, not starterPlayer.
potato |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 21 Aug 2015 10:00 PM |
Even with adding the changed event? What does output say?
Nvm your first if statement should work
That's in a gui do: if mouse.Target == MyBrick then MyBrick.BrickColor = BrickColor.Red() else MyBrick.BrickColor - BrickColor.Green() end |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2015 10:09 PM |
What do you mean in a gui??
The part turns Green but doesn't change to red when my mouse is over it nor when I click it. |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 21 Aug 2015 10:19 PM |
Don't mind he in a gui statement I'm not all here atm lol
What does output say if anything? It's a local script?
Try having it print mouse.Target upon changed |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2015 10:21 PM |
| Output says nothing, and yes it's local script, I tried to make it print mouse.Target upon changed but nothing comes through the output. |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2015 10:23 PM |
| Is it also to be noted that i'm using a custom mouse Icon?? Would that affect anything and, I tried the mouse changed thing again and the only time it printed was when (I'm assuming) the icon was changed to my custom one. |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 21 Aug 2015 10:45 PM |
I doubt the mouse icon has anything to do with it, But it could be and I'm a noob
Try changing local player = game.localplayer to player = script.Parent.Parent depending on where local script is located |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2015 09:13 AM |
| Ugh that didn't work either. And output still says nothing. :(( |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
| |
|
|
| 22 Aug 2015 04:28 PM |
This one?
local player = game.Players.LocalPlayer local mouse = player:GetMouse()
if mouse.Target == script.parent then local gui = Instance.new("ScreenGui", player.PlayerGui) local txt = Instance.new("TextLabel", gui) txt.Text = "Testing" txt.BackgroundColor = Color3.new(0,0,0) txt.BackgroundTransparency = .5 txt.TextColor = Color3.new(255,255,255) end |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 22 Aug 2015 04:32 PM |
| No the local script located in starter pack we worked on |
|
|
| Report Abuse |
|
|
Ortron
|
  |
| Joined: 19 Jul 2013 |
| Total Posts: 1297 |
|
|
| 22 Aug 2015 04:51 PM |
| If it's in starter pack then the parent is PlayerGui which will never be hit by the mouse. |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 22 Aug 2015 04:56 PM |
| A mouse can dream but let him post the script so we can actually see the issue |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2015 08:28 PM |
| Wait, so it has to be a script in the part?? |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2015 08:36 PM |
Here is our script, so far, it only prints once which is when i'm assuming the icon is changed.
local Mouse = game.Players.LocalPlayer:GetMouse() Mouse.Changed:connect(function(p) print('mouse changed') end) |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2015 08:47 PM |
| NVM I feel dumb, I just put it into a loop and it worked. Thank you for your help gnome!! |
|
|
| Report Abuse |
|
|