Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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)
0
Just make the server clone objects if you need them in the server User#20388 0 — 5y
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. CPF2 406 — 5y
0
How do I write the script to tell if a player pushes the key? Edbotikx 99 — 5y
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 Vulkarin 581 — 5y
0
Every game on roblox is using FE now. DevingDev 346 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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!

Ad

Answer this question