TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 14 Mar 2014 07:09 PM |
script.ChildAdded:connect(function(child) print("Activated") if child.Name == "Decal" then addid(child) end end)
This is a server side script in Workspace. A child (intvalue) IS added. It just.. Does nothing.
No output at all.
What's wrong? It should be so simple :p |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 07:10 PM |
erm,an intvalue will be named "Value" not decal..
and what is the function addid()?
please show a fuller script |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 14 Mar 2014 07:11 PM |
The intvalue is called "Decal" because I have a script which adds the intvalue to this script, and it names it "Decal".
This is probably wrong as it's a rough copy but I'd edit it with output usually, this is the addid function.
function addid(child) print("Decal added") decal = child.Value decalid = template..tostring(decal) print(decalid .. " will be displayed.") table.insert(ads, #ads+1, decalid) if start == false then startads() end end |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 07:12 PM |
| Where is the child inserted into? |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 14 Mar 2014 07:14 PM |
Like this:
Workspace.TheScript.ChildIsHere
So it's a child of thescript :p |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 07:16 PM |
| It should work. Check the name of the value? Is the script enabled? I don't know why it wouldn't be, but the syntax is fine. |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 14 Mar 2014 07:19 PM |
Weird.
I'll post both scripts here then I suppose. Maybe I've mucked up somewhere!
So the script that creates the intvalue is..:
text = script.Parent.Parent.Type ad = game.Workspace.ChangeAds
function changeboards() if tonumber(text.Text) then if #game:GetService("InsertService"):LoadAsset(tonumber(text.Text)):GetChildren() > 0 then ID = game:GetService("MarketplaceService"):GetProductInfo(tonumber(text.Text)) sv = Instance.new("IntValue") sv.Value = tonumber(text.Text) sv.Name = "Decal" sv.Parent = ad end end end
script.Parent.MouseButton1Down:connect(changeboards)
The script (serverscript) that SHOULD read this intvalue and do stuff is this:
template = "http://www.roblox.com/asset/?id=" ads = {} start = false currad = 0 billboards = game.Workspace.Openme.Billboards
function addid(child) print("Decal added") decal = child.Value decalid = template..tostring(decal) print(decalid .. " will be displayed.") table.insert(ads, #ads+1, decalid) if start == false then startads() end end
function startads() print("Starting.") start = true end
while wait() do if start == true then print("Running while loop") currad = currad+1 if #ads < currad then currad = 1 end local d = Instance.new("Decal") if billboards.Billboard1:findFirstChild("Decal") then billboards.Billboard1.Decal:destroy() end if billboards.Billboard2:findFirstChild("Decal") then billboards.Billboard2.Decal:destroy() end if billboards.Billboard3:findFirstChild("Decal") then billboards.Billboard3.Decal:destroy() end if billboards.Billboard4:findFirstChild("Decal") then billboards.Billboard4.Decal:destroy() end if billboards.Billboard5:findFirstChild("Decal") then billboards.Billboard5.Decal:destroy() end d.Texture = ads[currad] d.Parent = billboards.Billboard1 d.Parent = billboards.Billboard2 d.Parent = billboards.Billboard3 d.Parent = billboards.Billboard4 d.Parent = billboards.Billboard5 wait(5) end end
script.ChildAdded:connect(function(child) print("Activated") if child.Name == "Decal" then addid(child) end end) |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 07:21 PM |
| Put the .ChildAdded event before the loop. |
|
|
| Report Abuse |
|
|