I made a script that calls a RemoteEvent to determine what you are playing as. I put a value in the player's backpack so if it equals something you play as that character. But for some reason my RemoteEvent isn't working. Here is the script for calling the RemoteEvent.
1 | if Class.Value = = 1 or |
2 | Class.Value = = 0 then |
3 | game.Lightning.TestCharacter 1. RemoteEvent:FireServer() |
4 | end |
and here is the script for the RemoteEvent
01 | local player = game.Players.LocalPlayer |
02 | Folder = script.Parent |
03 | Event = Folder.IsChar 1 |
04 |
05 |
06 | script.Parent.RemoteEvent.OnServerEvent:connect( function () |
07 | player.Character.LowerTorso.Transparency = 0 |
08 |
09 | wait( 0.01 ) |
10 |
11 | player.Character.Head.face.Texture = "http://www.roblox.com/asset/?id=591414447" |
12 |
13 | local Sleeve = Instance.new( "Part" , player.Character) |
14 | Sleeve.CanCollide = false |
15 | Sleeve.Anchored = false |
^ is suppose to tell me if every part is welded to the player.
A Server Event should be fired in a local script and handled in a server script as I can see you handled it in local script which is wrong.
There is no need to make player
variable because you get that variable by default using
1 | RemoteEvent.OnServerEvent:connect( function (player) --- player variable |
so basically FireServer()
should be used in local script and OnServerEvent
should be used in server script.
Read this article for more info
You're using the wrong functions in the wrong scripts. You're firing the server from a server script, and then connecting to a server event from a local script.
Here's a rundown of RemoteEvent functions:
Use on server scripts only:
Use on local scripts only:
Make sure you're using these right and your RemoteEvent should work properly.
Also see: http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial