|
| 06 Aug 2014 03:03 AM |
Off of a few threads. I've come to this. I still need help though.
Basically when you select the tool and click on this brick with the code in it (below) it changes the Value of a NumberValue called "Bill" inside the brick. When the value is changed the SurfaceGui Text changes to the Value. But the problem is, it's not working. Help?
Output - 21:42:49.790 - Equipped is not a valid member of Part 21:42:49.792 - Script 'Workspace.Sign10.Main.Script', Line 4
Current Script: local bill = script.Parent.Bill local surfacegui = script.Parent.SurfaceGui.TextLabel
script.Parent.Equipped:connect(function(m) surfacegui.Text = ("$"..tostring(bill.Value)) end)
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 03:24 AM |
Please help me. Things like these are slowing my down on developing. I need to get this going please. someone.
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 03:25 AM |
| This script is in a part. It needs an extra .Parent or be parented to the tool. |
|
|
| Report Abuse |
|
|
2eggnog
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 1351 |
|
|
| 06 Aug 2014 03:29 AM |
| That script isn't even inside a tool. Why are you trying to use the Equipped event? |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 03:31 AM |
@2egg
This is an old script that I used that has the same function except it's made for an inside of a tool. That's why I need help converting it. I don't know what to do here so I just guessed.
local bill = script.Parent.Bill local surfacegui = script.Parent.SurfaceGui.TextLabel local tool = game.Workspace:FindFirstChild(hit.Parent).Tool
if tool.Equipped then if tool:Connect() then do surfacegui.Text = ("$"..tostring(bill.Value)) end end end
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 03:39 AM |
bump
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 03:47 AM |
1
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
Conmiro
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 3393 |
|
|
| 06 Aug 2014 03:52 AM |
--This must be inside a local script placed inside the tool. local player = game.Players.LocalPlayer local tool = script.Parent local mouse = player:GetMouse()
local canClick = false local newValue = 100 --This needs to be what you want to change the bill to when you click it. local textLabel = Workspace.Part.SurfaceGui.TextLabel --Wherever your text label is
mouse.Button1Down:connect(function() if mouse.Target ~= nil then if mouse.Target:findFirstChild("Bill") ~= nil then mouse.Target.Bill.Value = newValue textLabel.Text = newValue end end end)
tool.Equipped:connect(function() canClick = true end) tool.Unequipped:connect(function() canClick = false end) |
|
|
| Report Abuse |
|
|
Conmiro
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 3393 |
|
|
| 06 Aug 2014 03:53 AM |
--This must be inside a local script placed inside the tool. local player = game.Players.LocalPlayer local tool = script.Parent local mouse = player:GetMouse()
local canClick = false local newValue = 100 --This needs to be what you want to change the bill to when you click it. local textLabel = Workspace.Part.SurfaceGui.TextLabel --Wherever your text label is
mouse.Button1Down:connect(function() if mouse.Target ~= nil and canClick == true then if mouse.Target:findFirstChild("Bill") ~= nil then mouse.Target.Bill.Value = newValue textLabel.Text = newValue end end end)
tool.Equipped:connect(function() canClick = true end) tool.Unequipped:connect(function() canClick = false end)
I fixed the script. Forgot to add the check if the tool is equipped...Also uhmm this is kinda complex. If you don't get it, perhaps you shouldn't use the script. =\ |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 03:56 AM |
@Con For the Value how can I change it to where it will always have a dollarsign infront of it?
"$" ..newValue ??
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
Conmiro
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 3393 |
|
|
| 06 Aug 2014 03:57 AM |
| Yes that's exactly right, only for the TextLabel though. Don't try to set the NumberValue to that. |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 04:05 AM |
02:04:24.789 - Equipped is not a valid member of Part 02:04:24.790 - Script 'Players.Player1.Backpack.ViolationGiver.Handle.LocalScript', Line 19
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 04:06 AM |
Kind of edited the code to where it adds everytime you click?
But output prints that my post above.
local player = game.Players.LocalPlayer local tool = script.Parent local mouse = player:GetMouse()
local canClick = false local newValue = 1 --This needs to be what you want to change the bill to when you click it. local textLabel = game.Workspace.Sign10.Main.SurfaceGui.TextLabel --Wherever your text label is
mouse.Button1Down:connect(function() if mouse.Target ~= nil and canClick == true then if mouse.Target:findFirstChild("Bill") ~= nil then mouse.Target.Bill.Value = mouse.Target.Bill.Value + newValue textLabel.Text = "$"..Bill.Value end end end)
tool.Equipped:connect(function()canClick = true end) tool.Unequipped:connect(function()canClick = false end)
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 04:09 AM |
Nevermind. LocalScript was in a Handle. I made it script.Parent now,
But the value isn't changing. did I do something wrong?
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
Conmiro
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 3393 |
|
|
| 06 Aug 2014 04:11 AM |
| Let me try it out. One moment. |
|
|
| Report Abuse |
|
|
Conmiro
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 3393 |
|
|
| 06 Aug 2014 04:14 AM |
The line:
textLabel.Text = "$"..mouse.Target.Bill.Value
Before you just had Bill.Value |
|
|
| Report Abuse |
|
|
Conmiro
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 3393 |
|
|
| 06 Aug 2014 04:15 AM |
| I tested the code in my studio and it works if you make that change.. Let me know if you have any other problems. |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 04:32 AM |
Err. It's not working for me. The Value isn't changing.
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 04:37 AM |
/4a2dyc
prntscr
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
Conmiro
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 3393 |
|
|
| 06 Aug 2014 04:38 AM |
Are there any errors in the script?
try printing mouse.Target.Name
|
|
|
| Report Abuse |
|
|
Conmiro
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 3393 |
|
|
| 06 Aug 2014 04:39 AM |
In your script you have game.Workspace.Sign10
But in screenshot, it's just Sign. |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 04:41 AM |
Oh I changed it in the script too because i thought the '10' is something that would've broken it.
But that's not the case.
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 04:46 AM |
idk how to print it
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|
Conmiro
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 3393 |
|
| |
|
|
| 06 Aug 2014 05:08 AM |
> print(mouse.Target.Name) 03:07:30.407 - print(mouse.Target.Name):1: attempt to index global 'mouse' (a nil value) 03:07:30.408 - Stack Begin 03:07:30.408 - Script 'print(mouse.Target.Name)', Line 1 03:07:30.409 - Stack End
You just got Quarter-Term'd |
|
|
| Report Abuse |
|
|