Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Particles only visible for LocalPlayer?

I have made this script where when you click a Position you want to go a particle will come and make a cool teleportation effect. It works well however the issue is that only the LocalPlayer can see their own particles.

I was testing with my friends and it all worked for them but I couldn't see their particles and they couldn't see mine however they said they could see their own particles just not anybody elses.

I'm a bit confused on why I can't see their particles, just my own? Can someone please reply with an explanation. Thank you.

The Script:

local rep = game:GetService("ReplicatedStorage")
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
repeat wait() until char:FindFirstChild("Humanoid")
local human = char.Humanoid

repeat wait() until game.Players.LocalPlayer.Character
local MyBody = player.Character
local mouse = player:GetMouse()

local cd = false
script.Parent.Activated:connect(function()
	if cd == false then
		cd = true
		 local ee = rep.particle:Clone()
		human.WalkSpeed = 0
		ee.Parent = game.Workspace
		ee.Position = human.Parent["Left Leg"].Position
 local hit = mouse.Hit
		local qq = rep.particle:Clone()
		qq.Parent = game.Workspace
		qq.Position = hit.p
	wait(3)
 MyBody:MoveTo(hit.p)
	human.WalkSpeed = 16
	ee:Destroy()
			wait(1)
	qq:Destroy()
		wait(2)
	cd = false
end
	end)


1 comment

0

Roblox is built on server-cilent model. For example, server change can effect to cilent, but cilent change can't effect to server. Because of that, Roblox has made RemoteEvent and RemoteFunction https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

2 answers

✓ Accepted answer

Its because you are using localscripts, which makes changes for the localplayer only, while server makes the changes on the server, and thus, all clients. The teleportation only worked because one of the only things a client can replicate to the server is character position.

To make your script work you need a remoteevent object, which you set a function to work when its called on a server script. You then have to call the function from the localscript (probably inside script.Parent.Activated).

The reason it didn't work for you is because you were using a local script. This basically means that only clients (People) can see it not the server. If you want it to be on the server then put it in a server script. Else use a remote event.

This discussion is preserved as it was. New answers, comments, and votes are closed.