Local scripts are running as server expect for Gui local scripts

Sup guys.2 days ago i builded a script that uses hitbox to change the lightning.even the portals.but then i saw that local script is running on everybody.i dont know why this is happening.gui scripts are running by local but expect for gui local scripts,all of them are running in server even they are local script.this issue still didnt solved with all my tries.readd it,change parent of it,none of them still fixed the issue.
is this a roblox bug or our developers fault?

i tried search about this but nothing appeared about this issue.

What?

Can you please provide the relevant code, so we can check that you haven’t done it incorrectly?

heres better one=my local hitbox script is changing lightning when player touches,but with other players it happens to everyone when someone touches.idk why.i placed to Starterplayerscripts.

i cant send the code right now ill send after a hours later.

You need to check that the person who touches it is indeed the local player.

For example:

local Player = game.Players.LocalPlayer
Part.Touched:Connect(function(hit)
    if not hit.Parent = Player.Character then return end
    -- Other code here
end)

thats not the issue.at first,this is my hitbox script(local):

local Hitbox = workspace:WaitForChild("Map"):WaitForChild("Snow effect")
local Lighting = game:GetService("Lighting")

Hitbox.Touched:Connect(function(Hit)
	if Hit and Hit.Parent and Hit.Parent:FindFirstChildWhichIsA("Humanoid") then
		game:GetService("TweenService"):Create(Lighting.Atmosphere,TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.In),{Haze = 5}):Play()
		game:GetService("TweenService"):Create(Lighting.Atmosphere,TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.In),{Glare = 2}):Play()
		game:GetService("SoundService")["Main menu"].SoundId = "rbxassetid://17613644074"
	end
end)

Hitbox.TouchEnded:Connect(function()
	game:GetService("TweenService"):Create(Lighting.Atmosphere,TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.In),{Haze = 0}):Play()
	game:GetService("TweenService"):Create(Lighting.Atmosphere,TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.In),{Glare = 0}):Play()
	game:GetService("SoundService")["Main menu"].SoundId = "rbxassetid://16592010919"
end)

and yeah still triggering on everyone idk why.
whenever i touch the hitbox it changes on me.but also changes on other players too.

Hey hey i think i have found the solution.the touched event triggers on everybody when someone touches?

my fault… fixed by checking touched players name that its local players name.sorry,first time seeing…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.