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

How do I make somtehing that appears in local script visible to everybody else?

Asked by 4 years ago

I am making an fps and the hands and gun are only visible to the player with the local script how can I make the hands and gun visible to everybody? this script is in a local script in starter player in character scripts

local player =game.Players.LocalPlayer
local run = game:GetService("RunService")
local cam = workspace.CurrentCamera

local gun = game.ReplicatedStorage.Weapons.M1911:Clone()

gun:SetPrimaryPartCFrame(cam.CFrame)

local a = require(game.ReplicatedStorage.WeaponModules.M1911)

run.RenderStepped:Connect(function()
    gun:SetPrimaryPartCFrame(cam.CFrame * a.weaponpos)
end)

gun.Parent = cam
local idle = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.WeaponModules.M1911.Animations.Idle)
idle:Play()

2 answers

Log in to vote
0
Answered by 4 years ago

If you want to allow the character change their weapon independently of the server, I suggest you using RemoteEvents:

https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

RemoteEvents allow you to execute functions from the LocalPlayer to the server (and viceversa). You could make a function where the players creates a local weapon and welds It to their arm, and then fires a RemoteEvent to the server which sends another event to every client (except the one who requested It) and call that exact function to every player.

Ad
Log in to vote
0
Answered by 4 years ago

You have to use RemoteEvents to access the server from a local script..

Answer this question