uglypoe
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 4382 |
|
|
| 17 Sep 2015 08:27 PM |
SERVER SCRIPT: clonedpokemon = pokemon:clone() Cframe(clonedpokemon,"Chest",x,z) Cframe(clonedpokemon,"Arm1",x,z) Cframe(clonedpokemon,"Arm2",x,z) Cframe(clonedpokemon,"Leg1",x,z) Cframe(clonedpokemon,"Leg2",x,z) local numbertag = Instance.new("IntValue",clonedpokemon) numbertag.Name = "PokemonNumber" numbertag.Value = script.NumberSpawned.Value clonedpokemon.Parent = game.Lighting.SpawnedPokemon for _,plrs in pairs(game.Players:GetChildren()) do if script:FindFirstChild("Trainers"):FindFirstChild(plrs.Name) then game.ReplicatedStorage.SpawnPokemon:FireClient(plrs,{clonedpokemon:clone(),false}) end end
CLIENT SCRIPT: game.ReplicatedStorage.SpawnPokemon.OnClientEvent:connect(function(arguments) for i=1,#arguments do print(arguments[i]) end arguments[1].Parent = game.Workspace.CurrentCamera end)
Of course these aren't the entire scripts, just sections of each. However, the cloned model I'm trying to put through the remote event (arguments[1] and/or clonedpokemon:clone()) is printing as "nil". Any idea why? Filtering is enabled, if that helps. |
|
|
| Report Abuse |
|
|
uglypoe
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 4382 |
|
|
| 17 Sep 2015 08:35 PM |
| bump, need to fix this soon |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 08:40 PM |
Maybe try this local clonedclonedpokemon = clonedpokemon:Clone() clonedclonedpokemon.Parent = blahblah event:FireClient(client,{clonedclonedpokemon,false}) |
|
|
| Report Abuse |
|
|
uglypoe
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 4382 |
|
|
| 17 Sep 2015 08:48 PM |
@morashsPeasant It worked! Thank you! It looks like it has to be cloned and then parented to Lighting before transmitting it through the remote event. I think that's due to Filtering being Enabled. Thanks again! |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 08:51 PM |
You can't send Instances through RemoteEvents, only references to Instances which are already parented somewhere in the DataModel that can be accessed by the peer which is being sent the reference.
Another tip for organization: you shouldn't store items in the lighting. Consider using ReplicatedStorage or ServerStorage instead(depending on your storage purpose). |
|
|
| Report Abuse |
|
|
uglypoe
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 4382 |
|
|
| 17 Sep 2015 08:54 PM |
| @forever What's better about using ServerStorage compared to Lighting? Since I started using studio, Lighting was the main area to store things, and it is still reliable. |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 08:58 PM |
The advantage of using ServerStorage to store items is that those items can't be accessed by the client. This means that the client won't have to load those items when joining the game, and won't be able to modify or steal those items. However, ReplicatedStorage is still necessary if the client needs to access those items.
ReplicatedStorage is really the same thing as using Lighting to store items. The only advantage is organization. Say someone else edits your game, or you come back to a project a few months later and want to find an item that is stored in your game. They/you would probably first look under ReplicatedStorage. It also facilitates finding items that must be stored under lighting, such as Skyboxes. |
|
|
| Report Abuse |
|
|