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.
if Class.Value == 1 or Class.Value == 0 then game.Lightning.TestCharacter1.RemoteEvent:FireServer() end
and here is the script for the RemoteEvent
local player = game.Players.LocalPlayer Folder = script.Parent Event = Folder.IsChar1 script.Parent.RemoteEvent.OnServerEvent:connect(function() player.Character.LowerTorso.Transparency = 0 wait(0.01) player.Character.Head.face.Texture = "http://www.roblox.com/asset/?id=591414447" local Sleeve = Instance.new("Part", player.Character) Sleeve.CanCollide = false Sleeve.Anchored = false Sleeve.BrickColor = BrickColor.new("Maroon") Sleeve.Size = Vector3.new(1.11, 1.2, 1.07) local w = Instance.new("Weld", Sleeve) w.Part0 = player.Character.RightUpperArm w.Part1 = Sleeve w.C1 = CFrame.new(0,-0.36,0) local Sleeve2 = Instance.new("Part", player.Character) Sleeve2.CanCollide = false Sleeve2.Anchored = false Sleeve2.BrickColor = BrickColor.new("Maroon") Sleeve2.Size = Vector3.new(1.11, 1.2, 1.07) local w = Instance.new("Weld", Sleeve) w.Part0 = player.Character.LeftUpperArm w.Part1 = Sleeve2 w.C1 = CFrame.new(0,-0.36,0) local Tanktop = game.ReplicatedStorage.Union:Clone() Tanktop.Parent = player.Character local w = Instance.new("Weld", Sleeve) w.Part0 = player.Character.UpperTorso w.Part1 = Tanktop w.C1 = CFrame.new(0,0.18,0) local UpPant = Instance.new("Part", player.Character) UpPant.CanCollide = false UpPant.Anchored = false UpPant.BrickColor = BrickColor.new("Really black") UpPant.Size = Vector3.new(1.08, 1.21,1.04) local w = Instance.new("Weld", player.Character) w.Part0 = player.Character.LeftUpperLeg w.Part1 = UpPant w.C0 = CFrame.new(0,0.25,0) local UpPant2 = Instance.new("Part", player.Character) UpPant2.CanCollide = false UpPant2.Anchored = false UpPant2.BrickColor = BrickColor.new("Really black") UpPant2.Size = Vector3.new(1.08, 1.29,1.04) local w = Instance.new("Weld", player.Character) w.Part0 = player.Character.RightUpperLeg w.Part1 = UpPant2 w.C0 = CFrame.new(0,0.15,0) local LowPant = Instance.new("Part", player.Character) LowPant.CanCollide = false LowPant.Anchored = false LowPant.BrickColor = BrickColor.new("Really black") LowPant.Size = Vector3.new(1.08, 1.23,1.04) local w = Instance.new("Weld", player.Character) w.Part0 = player.Character.RightLowerLeg w.Part1 = LowPant w.C0 = CFrame.new(0,0,0) local LowPant1 = Instance.new("Part", player.Character) LowPant1.CanCollide = false LowPant1.Anchored = false LowPant1.BrickColor = BrickColor.new("Really black") LowPant1.Size = Vector3.new(1.08, 1.21,1.04) local w = Instance.new("Weld", player.Character) w.Part0 = player.Character.LeftLowerLeg w.Part1 = LowPant1 w.C0 = CFrame.new(0,0,0) end) print("works")
^ 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
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