generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Strange problem with Remote Events?

Previous Thread :: Next Thread 
uglypoe is not online. 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 is not online. uglypoe
Joined: 26 Mar 2011
Total Posts: 4382
17 Sep 2015 08:35 PM
bump, need to fix this soon
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
17 Sep 2015 08:40 PM
Maybe try this
local clonedclonedpokemon = clonedpokemon:Clone()
clonedclonedpokemon.Parent = blahblah

event:FireClient(client,{clonedclonedpokemon,false})
Report Abuse
uglypoe is not online. 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
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
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 is not online. 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
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image