Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 18 May 2015 02:12 PM |
So this script is used for summoning a NPC ally in an old RPG script im refitting, But for some reason whenever i summon the NPC it falls apart. I get no errors with the RemoteErrorMonitoring script and it works fine if im not playing online. (note: this is a localscript in a GUI button)
player = game.Players.LocalPlayer button = script.Parent wait(1) lvl = player.Config.Level newcr = nil crtype = 1 childsnew = game.Lighting:GetChildren() for k,v in pairs(childsnew) do if v.ClassName == "Model" and v:findFirstChild("Num") and v:findFirstChild("Num").Value == crtype then newcr = v end end frame = script.Parent.Parent.Parent.CommandFrame a = frame.Ability dam = frame.Damage mul = frame.Multiplier nam = frame.NameC t = frame.Type vec = Vector3.new(5,0,0)
function click()
local cr = player.Character:findFirstChild("Creature") if cr ~= nil then return end
if lvl.Value >= 60 then local c = newcr:Clone() local childs = c:GetChildren() for i = 1,#childs do if childs[i].ClassName == "Part" then childs[i].Anchored = true end end local b = c["Young Golem"]
a.Text = "Ability: "..b.Settings.Ability.Value dam.Text = "Damage: "..b.Settings.Damage.Value mul.Text = "Multiplier: "..b.Settings.Multiplier.Value nam.Text = "Name: "..b.Settings.EnemyName.Value t.Text = "Type: "..b.Settings.Type.Value c.Parent = player.Character c:MakeJoints() local childsn = c:GetChildren() for i = 1,#childsn do if childsn[i].ClassName == "Part" then wait(0.1) childsn[i].Anchored = false end end c:MoveTo(player.Character.Torso.Position + vec) wait(0.1) local creator_tag=Instance.new("ObjectValue") creator_tag.Value=game.Players.LocalPlayer creator_tag.Name="creator" creator_tag.Parent= b.Humanoid b.Follow.Disabled = false b.NameUpdater.Disabled = false end
end
button.MouseButton1Click:connect(click)
Any help apreciated |
|
|
| Report Abuse |
|
|
xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 18 May 2015 02:43 PM |
"Falls apart"
U Most lieky free modeled and dint achor... |
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 18 May 2015 06:39 PM |
1. if i had done that then it wouldnt work in solo mode either 2. if you read teh script it double checks that anchor is true so it shouldnt need to be anchored 3. i tried anchoring earlier and it didnt fix |
|
|
| Report Abuse |
|
|
br44n5m
|
  |
| Joined: 01 May 2010 |
| Total Posts: 20 |
|
|
| 18 May 2015 08:06 PM |
| If your gonna reply a fix then please refrain from accusing it of being a freemodel, people work hard on scripts |
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 19 May 2015 06:37 PM |
| would apreciate an expediant answer, i still have no idea whats wrong :/ |
|
|
| Report Abuse |
|
|
loweras
|
  |
| Joined: 20 Feb 2015 |
| Total Posts: 39 |
|
|
| 19 May 2015 06:43 PM |
Maybe not make it a local script? Idk, I'm new to scripting I know a few things, don't know many.
A wise robloxian named loweras once said "Do only the things your good at, not the ones your not". |
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 22 May 2015 01:51 AM |
@loweras
good idea, already tried making it a regular script, and the whole script broke (not because of the "localplayer" not being present I fixed that when i converted it) thank you tho cause that was actually a good idea |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 03:12 AM |
Remove the "locals", but keep it in a local script.
"Local: This item should be used with a LocalScript in order to work as expected in online mode." - from wiki |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 May 2015 04:33 AM |
| hey, that works whenever this happens to me so im just trying to help. |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 04:34 AM |
try MakeJoints() on the NPC
NOW GATHER,UNDER THE NAME OF TEAM ROCKET! |
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 24 May 2015 04:47 PM |
@FelixFlaviusRaxtus Did not work, interesting idea tho that has worked for me on things before but i wouldnt do that in general if i were you scince it may cause the script to break in worse ways later @Snowskateer Already has MakeJoints() in the script although u did inspire me to try having it done later in teh script, did not fix however
Thanks for the good suggestions but no dice :/ |
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 24 May 2015 04:59 PM |
Also i had the same problem with an NPC random-spawn script awhile ago so i am guessing the problem occurs when it gets moved. Just have no clue what to do about it
|
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 03 Jun 2015 11:44 PM |
| Still unsolved... would really apreciate help, would pay for help but im broke so... any help available, there are no bad suggestions at this point |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 03 Jun 2015 11:45 PM |
| :MakeJoints the whole model after cloning and after moving and after parenting |
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 03 Jun 2015 11:47 PM |
| @Crowclaw should i remove the existing "makejoints"? or just leave in both? |
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 03 Jun 2015 11:51 PM |
| @me, crow in hindsight that was a stupid question, nevermind that last |
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 04 Jun 2015 02:09 AM |
| Yeah! it is now able to work (although it still takes like 10 tries) im gonna try having it re-anchor after it moves the NPC and before it does makejoints() and then re-unanchor and see if that makes it run a bit smoother |
|
|
| Report Abuse |
|
|
Kenvarus
|
  |
| Joined: 21 Apr 2009 |
| Total Posts: 57 |
|
|
| 04 Jun 2015 02:18 AM |
Alright that made a distinct improvement but if anyone has any further suggestions on how to streamline the script a bit then i wont complain, here is the script as it now reads.
player = game.Players.LocalPlayer button = script.Parent wait(1) lvl = player.Config.Level newcr = nil crtype = 1 childsnew = game.Lighting:GetChildren() for k,v in pairs(childsnew) do if v.ClassName == "Model" and v:findFirstChild("Num") and v:findFirstChild("Num").Value == crtype then newcr = v end end frame = script.Parent.Parent.Parent.CommandFrame a = frame.Ability dam = frame.Damage mul = frame.Multiplier nam = frame.NameC t = frame.Type vec = Vector3.new(5,0,0)
function click()
local cr = player.Character:findFirstChild("Creature") if cr ~= nil then return end
if lvl.Value >= 60 then local c = newcr:Clone() local childs = c:GetChildren() for i = 1,#childs do if childs[i].ClassName == "Part" then childs[i].Anchored = true end end local b = c["Young Golem"]
a.Text = "Ability: "..b.Settings.Ability.Value dam.Text = "Damage: "..b.Settings.Damage.Value mul.Text = "Multiplier: "..b.Settings.Multiplier.Value nam.Text = "Name: "..b.Settings.EnemyName.Value t.Text = "Type: "..b.Settings.Type.Value c.Parent = player.Character local childsn = c:GetChildren() for i = 1,#childsn do if childsn[i].ClassName == "Part" then childsn[i].Anchored = false end end c:MoveTo(player.Character.Torso.Position + vec) wait(0.1) local childs2 = c:GetChildren() for i = 1,#childs2 do if childs2[i].ClassName == "Part" then childs2[i].Anchored = true end end local creator_tag=Instance.new("ObjectValue") creator_tag.Value=game.Players.LocalPlayer creator_tag.Name="creator" creator_tag.Parent= b.Humanoid b.Follow.Disabled = false b.NameUpdater.Disabled = false c:MakeJoints() local childs3 = c:GetChildren() for i = 1,#childs3 do if childs3[i].ClassName == "Part" then childs3[i].Anchored = false end end end
end
button.MouseButton1Click:connect(click)
|
|
|
| Report Abuse |
|
|