Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How come if something is replicated with a localscript it isn't done on the server?

It seemed to work a few months ago. It's done by putting a localscript within a tool, and on the press of a key it replicates the corresponding part. But it doesn't work on the server. So how else can I write the script? Here is an example of what I'm using.

uis.InputBegan:connect(function(input,process) -- Skill Five
if not process and active == true and   input.KeyCode == Enum.KeyCode.V and player.PlayerGui.PlayerUI.Skills.Skill5.Visible == true and stunned == false then
player.PlayerGui.PlayerUI.Skills.Skill5.Visible = false
wait(0.3)
 local         bullet = game.ReplicatedStorage.Necro.Raise:Clone()
        bullet.Parent = game.Players.LocalPlayer.Character.Holder
        bullet.CFrame = game.Players.LocalPlayer.Character.LeftHand.CFrame	y = Instance.new("BodyVelocity")
		y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
		y.velocity = player.Character.HumanoidRootPart.CFrame.lookVector*50
      	        y.Parent = bullet
wait (15)
player.PlayerGui.PlayerUI.Skills.Skill5.Visible = true


 end end)

5 comments

0

Just make the server clone objects if you need them in the server

0

what the above comment said, it will work in studio because everything in studio is run locally, but in the game it wont replicate to other clients.

0

How do I write the script to tell if a player pushes the key?

1

You won't be able to do that from a server script, you'll need communication between a local script that gets input and a server script that does replication http://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events

0

Every game on roblox is using FE now.

1 answer

A LocalScript is on the client and any changes made to the game from the client will not replicate to the server. That means that any thing put into the game via a LocalScript will not be changed on the server and will only affect the client. You will have to look into remote events and functions to allow communication between the client and server. Here is a link, Hope this helps and have a great day scripting!

This discussion is preserved as it was. New answers, comments, and votes are closed.