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: Why doesn't this work?

Previous Thread :: Next Thread 
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 03:16 PM
So I'm converting a game to filteringEnabled, and I'm using a RemoteFunction to cross the 'boundary', but it's not working. Can anyone tell me why?

--Local Script
function SavePlayerCar()
local CarToClone = game.Workspace:WaitForChild(plr.Name .. "s_CustomCar")
local CarClone = CarToClone:Clone()
local CarName = CarToClone.Car.CarName.Value
local CarPack = game.Lighting:WaitForChild(plr.Name.."s_CarPack")
--Save car to player's custom car pack
CarPack:WaitForChild(CarName):remove()
CarClone.Parent = CarPack
CarClone.Name = CarName
game.Workspace.Events.CarSaver:InvokeServer(CarClone)
end
script.Parent.Save.MouseButton1Click:Connect(SavePlayerCar)

--Server Script
function game.Workspace.Events.CarSaver.OnServerInvoke(Player, CarClone)
print(CarClone.Name)
end


And it's saying that CarClone is a Nil Value in the server script.
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 03:26 PM
bump1
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
09 Aug 2017 03:29 PM
Destroy not remove
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 03:32 PM
That's not what I asked.
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
09 Aug 2017 03:34 PM
Put the remote function in replicated storage


Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 03:34 PM
Replacing 'remove()' with 'Destroy()' won't do anything for what I'm asking.
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 03:38 PM
and caca50, that didn't work.
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
09 Aug 2017 03:44 PM
I can see you're using a lot of things that are not recommended anymore. As already mentioned, use :Destroy(), not :remove() Use ReplicatedStorage for housing instances that should be used by both the server and the client. Use ServerStorage for storage for the server, not Lighting. Lighting should only deal with skies, visual effects, etc. Use ServerScriptService to house server scripts, workspace will also work for this. A LocalScript will only run Lua code if it is a descendant of one of the following objects: A Player's Backpack, such ## # ##### of a Tool A Player's Character model A Player's PlayerGui A Player's PlayerScripts The ReplicatedFirst service Make sure your local script abides by those rules^ After you fix those issues, post back here if the problem persists. Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
09 Aug 2017 03:45 PM
I can see you're using a lot of things that are not recommended anymore.

As already mentioned, use :Destroy(), not :remove()

Use ReplicatedStorage for housing instances that should be used by both the server and the client.

Use ServerStorage for storage for the server, not Lighting. Lighting should only deal with skies, visual effects, etc.

Use ServerScriptService to house server scripts, workspace will also work for this.

A LocalScript will only run Lua code if it is a descendant of one of the following objects:
A Player's Backpack, such as a descendant of a Tool
A Player's Character model
A Player's PlayerGui
A Player's PlayerScripts
The ReplicatedFirst service
Make sure your local script abides by those rules^

After you fix those issues, post back here if the problem persists.


Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 05:49 PM
So I adjusted for things that needed to be adjusted that you listed, yet it still doesn't work.

--Local Script, in the player's GUI
function SavePlayerCar()
local CarToClone = game.Workspace:WaitForChild(plr.Name .. "s_CustomCar")
local CarClone = CarToClone:Clone()
local CarName = CarToClone.Car.CarName.Value
local CarPack = game.ReplicatedStorage:WaitForChild(plr.Name.."s_CarPack")
--Save car to player's custom car pack
CarPack:WaitForChild(CarName):Destroy()
CarClone.Parent = CarPack
CarClone.Name = CarName
game.ReplicatedStorage.Events.CarSaver:InvokeServer(CarClone)
end
script.Parent.Save.MouseButton1Click:Connect(SavePlayerCar)

--Server Script, in ServerScriptService

function game.ReplicatedStorage.Events.CarSaver.OnServerInvoke(Player, CarClone)
print(CarClone.Name)
end


And it's still saying that CarClone is a nil value.
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
09 Aug 2017 05:50 PM
print CarClone.Name on the client and tell me if the name prints
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 05:53 PM
Yep, it printed fine on the client.
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 06:15 PM
bump
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
09 Aug 2017 06:22 PM
idk dude
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 06:28 PM
Anyone else have an idea?
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
09 Aug 2017 06:32 PM
"CarClone.Parent = CarPack"

Is CarPack nil?

Any other errors?


Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 06:43 PM
Nope, the only error is that CarClone is nil.
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 06:44 PM
And it's an error on the Server script.
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
09 Aug 2017 06:46 PM
"local CarToClone = game.Workspace:WaitForChild(plr.Name .. "s_CustomCar")"

How exactly is CarToClone being instantiated? If it's being created on the client, then that's your problem


Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
peacefiltyler101 is not online. peacefiltyler101
Joined: 14 Feb 2011
Total Posts: 81
09 Aug 2017 06:47 PM
i love ur siggy
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 07:40 PM
All of this is taking place on the Client's workspace, and I'm trying to copy a car that only exists for the client and replicate it so the server into a custom bin for the player to use later.
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
09 Aug 2017 07:56 PM
Create the car in the server


Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil)
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 08:14 PM
But I only want 1 player to see it; the player who spawned it. In this case, they are customizing their car, not spawning it to be driven.


I have the system for spawning a car for driving done.
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 09:07 PM
bump
Report Abuse
brennisawesome is not online. brennisawesome
Joined: 26 Oct 2012
Total Posts: 1658
09 Aug 2017 11:23 PM
bump
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