TellerMan
|
  |
| Joined: 23 Apr 2010 |
| Total Posts: 237 |
|
|
| 04 Jul 2013 11:38 AM |
I am trying to make a RPG quest and GUI... And it checks when you kill a bandit... Well it should. First the checking script doesnt seem to do anything. Second this error pops up for this script in the GUI.
First Script -
while script.Parent ~= nil do if script.Parent.Humanoid.Health < 1 then print("Part 1/5 Done!") function onQuest(player) print("Part 2/5 Done!") if script.Parent.Parent == player then print("Part 3/5 Done!") local name = player.Name local Player = game.Players:findFirstChild(name) if Player ~= nil then print("Part 4/5 Done!") local questGui = Player.PlayerGui.Objective if questGui ~= nil then print("Part 5/5 Done!") local kills = questGui.Items kills.Value = kills.Value + 1 print("YAY IT WOKRED!") end end end end end wait() repeat wait() until script.Parent == nil end
---------------------------------------------------------------------------------------------------------------- Second Script -
while true do local kiwi = script.Parent.Items local items = script.Parent.Item1 local done = false items.Text = kiwi .. "/3" if kiwi == 3 then done = true end wait() repeat wait() until done end
[[[[[[[[For this script, output says: 12:36:08.561 - Players.Player1.PlayerGui.Objective.Items.ItemSensor:5: attempt to concatenate local 'kiwi' (a userdata value) 12:36:08.562 - Script "Players.Player1.PlayerGui.Objective.Items.ItemSensor", Line 5 12:36:08.563 - stack end]]]]]]
{{{{{SORRY FOR THE HUGE POST... it's just this is a huge problem and i want to fix it}}}}}}}} |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2013 11:48 AM |
local kiwi = script.Parent.Items -- group? local items = script.Parent.Item1 local done = false items.Text = kiwi .. "/3" -- basically, doesn't like this, the "kiwi" value has to be a string
Possible Solutions?
local kiwi = script.Parent.Items.Name --might be what you want local items = script.Parent.Item1 local done = false items.Text = kiwi .. "/3
local kiwi = script.Parent.Items.Value --If it's a StringValue etc.. local items = script.Parent.Item1 local done = false items.Text = kiwi .. "/3 |
|
|
| Report Abuse |
|
|
TellerMan
|
  |
| Joined: 23 Apr 2010 |
| Total Posts: 237 |
|
|
| 04 Jul 2013 11:57 AM |
Oh thanks, I realized I needed the value. Items is a NumValue.
while true do local kiwi = script.Parent.Items local items = script.Parent.Item1 local done = false items.Text = kiwi.Value .. "/3" if kiwi.Value == 3 then done = true end wait() repeat wait() until done end |
|
|
| Report Abuse |
|
|
TellerMan
|
  |
| Joined: 23 Apr 2010 |
| Total Posts: 237 |
|
|
| 04 Jul 2013 12:16 PM |
This script still does not work though! I realized I had to call/connect the function so that it would execute but what next?
while script.Parent ~= nil do local Humanoid = script.Parent.Humanoid if Humanoid.Health < 1 then print("Part 1/5 Done!") function onQuest(player) print("Part 2/5 Done!") if script.Parent.Parent == player then print("Part 3/5 Done!") local name = player.Name local Player = game.Players:findFirstChild(name) if Player ~= nil then print("Part 4/5 Done!") local questGui = Player.PlayerGui.Objective if questGui ~= nil then print("Part 5/5 Done!") local kills = questGui.Items kills.Value = kills.Value + 1 print("YAY IT WOKRED!") end end end end Humanoid.Died:connect(onQuest) end wait() repeat wait() until script.Parent == nil end
|
|
|
| Report Abuse |
|
|
|
| 06 Jul 2013 04:53 AM |
Try making
local Player = game.Players:findFirstChild(name)
to just Player, not local Player, that might solve it? Althouggh i'm unsure, does output not display anything? |
|
|
| Report Abuse |
|
|