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

[F.E.] How can I make a part from the Client be visible on the Server?

Asked by 6 years ago
Edited 6 years ago

I've tried for hours but I really don't get it. I watched AlvinBlox's, SnakeWorl's and ScriptGuider's videos on RemoteEvents. The code I wrote creates a pet (Part with mesh) from the client, I want it to be visible to all players, not just the client it was created on. Can someone please help me?

Script is in StarterGui

Code:

local plr = game.Players.LocalPlayer
local petname = game.Players.LocalPlayer.Pet.PetName.Value
local mesh = game.ReplicatedStorage:FindFirstChild(petname)
-- local fly = game.Players.LocalPlayer.Pet.DoesItFly.Value
-------------------------------------------------------------
wait(2)
local part = Instance.new('Part', workspace[plr.Name].Torso)
part.CanCollide = false
part.Anchored = true
part.Size = Vector3.new(1,1,1)
mesh:Clone().Parent = part
local direction = CFrame.new(part.Position, plr.Character['Left Leg'].Position).lookVector
local increment = direction * 4
while true do
    wait()
    part.CFrame = game.Workspace[plr.Name]['Torso'].CFrame + (direction * increment) + Vector3.new(-5,0,0)
    part.Rotation = game.Workspace[plr.Name]['Torso'].Rotation + (direction * increment) + Vector3.new(-1,-2,increment)
end

Answer this question