It also makes the other player get the model summoned to them later on randomly without even pressing the button.
I would like some help on the topic.
Or at least how to fix my code so it can be seen by other players.
This is my first topic. So I’m sorry if its wrongly done or something.
LocalScripts do not replicate to the server or other clients; you’re going to need to use RemoteEvents (or just put the entire thing in a Server-Sided script and change a lot of stuff) to get the affects you want for all clients.
I do not really know how I mean I tried to get it to work but most of the script just breaks down until it hardly works.
I tried modifying it but that didn’t prove successful
Thanks for the quick reply though!
Read this article on Remote Functions and Events to get a better understanding of what im saying! They come in really useful. If you need me to explain please do say so.
I have read that And I understand the remote events and functions of it but it proved in successful for me.
Maybe you could try to help me fix the code to make it server sided or help with remote events for the scripts to work.
I could invite you to my studio if need be.
Ok well- first I would change all things like game.Players.LocalPlayer to use something like
game:GetService("Players").PlayerAdded:Connect(function(plr)
-- put code in here
end
You need to use RemoteEvents to use :GetMouse() on the server, as it does not work if it’s not on the client. Here is an example:
RemoteEvent in ReplicatedStorage
-- ServerScript in ServerScriptService:
local remote = game:service'ReplicatedStorage'.RemoteEvent
remote.OnServerEvent:Connect(function(plr, mouse)
print(mouse.X, mouse.Y)
end)
-- LocalScript in StarterCharacterScripts:
local remote = game:service'ReplicatedStorage'.RemoteEvent
local uip = game:service'UserInputService'
uip.InputBegan:Connect(function(x,gp)
if not gp then
remote:FireServer(game.Players.LocalPlayer:GetMouse())
end
end)
Unfortunately, I can’t join your studio as I’m only here to help on the forum. If you need anything here though, you can always ask.
So I would put a remote event in replicated storage and a server script in server script service and in starter character scripts I would have
local remote = game:service’ReplicatedStorage’.RemoteEvent
local uip = game:service’UserInputService’
uip.InputBegan:Connect(function(x,gp)
if not gp then
remote:FireServer(game.Players.LocalPlayer:GetMouse())
end
end)
How Would I get the rest of the code like where would I put it?
I feel ashamed of this post, lol I’m way better at scripting now also I forgot to mark you as a solution as I was new to the dev forum but thanks for helping me back then; here.