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

My lightbeam cant be seen by other players??

so i tested my script in studio, but other players cant see it cause its a local script. Is there anyway to let other people see it in a local script?

local Tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local Character = player.Character

local en = true
Tool.Equipped:Connect(function(mouse)
print("Tool equipped!")
if not en then return end
 en = false
Tool.RemoteEvent:FireServer(mouse.Hit)
wait(.5)
 en = true
	
Tool.Activated:Connect(function()
	print("Mouse pressed!")
	local ray = Ray.new(Tool.Handle.CFrame.p, (mouse.Hit.p - 	Tool.Handle.CFrame.p).unit * 300)
	local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)

	local beam = Instance.new("Part", workspace)
	beam.BrickColor = BrickColor.new("New Yeller")
	beam.FormFactor = "Custom"
	beam.Material = "Neon"
	beam.Transparency = 0.25
	beam.Anchored = true
	beam.Locked = true
	beam.CanCollide = false

	local distance = (Tool.Handle.CFrame.p - position).magnitude
	beam.Size = Vector3.new(.5, .5, distance)
	beam.CFrame = CFrame.new(Tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)

	game:GetService("Debris"):AddItem(beam, 1)
	

	
	
	
	
	
	
	
	
	
	if part then
		local humanoid = part.Parent:FindFirstChild("Humanoid")

		if not humanoid then
			humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
		end

		if humanoid then
			humanoid:TakeDamage(30)
		end
	end
	
	beam.Touched:Connect(function(hit)
		local Sound = Instance.new("Sound")
		Sound.SoundId = "rbxasset://sounds//Rocket shot.wav"
		Sound.Parent = player.Character.HumanoidRootPart
		Sound.PlaybackSpeed = 1
		Sound.Volume = .5
		Sound.MaxDistance = 500
		Sound:Play()
		if not en then return end
en = false

		for i = 1,10 do
			local Explosion = Instance.new("Part")
			Explosion.BrickColor = BrickColor.new("New Yeller")
			Explosion.Shape = Enum.PartType.Ball
			Explosion.Material = "Neon"
			Explosion.FormFactor = "Custom"
			Explosion.Transparency = 0.25
			Explosion.Size = Vector3.new(50,50,50)
			Explosion.CanCollide = false
			Explosion.Anchored = true
			Explosion.Locked = true
			Explosion.CFrame = beam.CFrame
			Explosion.Parent = game.Workspace
			game.Debris:AddItem(Explosion,1)
			wait(0.005)
			Explosion.Size = Vector3.new(55,55,55)
			wait(0.005)
			Explosion.Size = Vector3.new(58,58,58)
			wait(0.005)
			Explosion.Size = Vector3.new(60,60,60)
			wait(0.005)
			Explosion.Size = Vector3.new(65,65,65)
			wait(0.005)
			Explosion.Size = Vector3.new(70,70,70)
			wait(0.005)
			Explosion.Size = Vector3.new(75,75,75)
			
			
			wait()
			en = true
			
			end
		
		end)
	end)


end)

2 comments

0

Use remote events to create it from a server script

0

how

1 answer

✓ Accepted answer

Hi, I haven't read all your script but to put this in a server script so players can see by using a remoteEvent is pretty simple, just have the script how it is in a local script, but when you go to do something you want players to see instead of writing that portion out, Example vv

player.Light.Visable = true ---- << EXAMPLE

in the local script type

game.ReplicatedStorage.RemoteEvent:FireServer()

then put the RemoteEvent in the replicatedstorage, then in your server script type

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
player.Light.Visable = true --- << EXAMPLE

Sorry for not reading the script, but in reality it should be similar to this, let me know if it helped!

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