Pretty much this a object deploying script for my game and as of recently only the person who deploys the object can see the object, noone else can see it.
local bin = script.Parent local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local equip = false bin.Equipped:connect(function(mouse) equip = true if equip == true then Mouse.Button1Down:connect(function() local model = game.ReplicatedStorage.GoodStuff.Seedling:clone() model.Parent = game.Workspace model:MoveTo(Mouse.hit.p) script.Parent.Seedling.Growth.Disabled = false script.Parent:Remove() end) end end) bin.Unequipped:connect(function(mouse) equip = false end)
This is likely an issue with Experimental Mode, formerly known as Filtering Enabled. This issue is likely cause be Experimental Mode being disabled. Since the script is inside of the player, and it is placing something into the workspace, only that player can see the object placed. No other players can see it, unless the object is spawned using a server script inside of a server-sided service (Ex. Workspace, ServerScriptService etc.). To fix this, you could either enable experimental mode (I do not recommend that) or use RemoteEvents/Functions, to have the object spawn through a server script in a server-sided service.
RemoteEvent
to clone the seedling.local ReplicatedStorage = game:GetService("ReplicatedStorage") local CloneSeedling = ReplicatedStorage:WaitForChild("CloneSeedling") local UserInputService = game:GetService("UserInputService") local playerMouse = game:GetService("Players").LocalPlayer:GetMouse() local tool = script.Parent UserInputService.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 and equipped then CloneSeedling:FireServer(playerMouse.Hit, "Seedling") tool.Seedling.Growth.Disabled = false tool:Destroy() -- :Destroy not :Remove end end) tool.Equipped:Connect(function(mouse)-- :Connect not :connect equipped = true end) tool.Unequipped:Connect(function() -- No mouse parameter. equipped = false end)
local ReplicatedStorage = game:GetService("ReplicatedStorage") local CloneSeedling = ReplicatedStorage:WaitForChild("CloneSeedling") CloneSeedling.OnServerEvent:Connect(function(plr, pos, name) local model = ReplicatedStorage.GoodStuff[name] model:Clone().Parent = game.Workspace model:MakeJoints() model:SetPrimaryPartCFrame(pos) -- Set a PrimaryPart for your mode and use this instead of MoveTo end)
Mouse.hit
, RBXScriptSignal:connect()
, Instance:clone()
, and Instance:Remove()
are deprecated. Learn more on deprecation here.The most likely source to a client-only object would involve Filtering Enabled. Due to your problem, I'm assuming that you have Filtering Enabled on (which you should) so the problem would be with your script. I'm also going to assume your script is a local script because of the game.Players.LocalPlayer
.
When you spawn an object using the client (localscript) and Filtering Enabled is true, the server will not replicate this object to the other clients for security purposes. That would be why it only shows up for just that player. I suggest you either convert your script into a server script and use bin.Activated
to detect when the player clicks (because server scripts cannot get a Player's mouse) or just put the chunk of code you want to be replicated to every client in a server script and use RemoteEvents.
A guide for RemoteEvents and Server to Client communication can be found on the ROBLOX Wiki if you need it.