Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this applying the script to everyone in the game?

Asked by 5 years ago
Edited 5 years ago

When this script is run, it applies these changes to everyone. I would like to know how to fix that.

ServerScript

local torso = script.Parent.Parent.Torso
local State1 = torso:WaitForChild("PrePS1State")
local State2 = torso:WaitForChild("PrePS2State")
local State3 = torso:WaitForChild("PureState1State")
local State4 = torso:WaitForChild("PureState2State")

local r = game:GetService("ReplicatedStorage")
local e = r.StateEvents

e.PrePS1.OnServerEvent:Connect(function(plr)
    wait(.2)
    local p = Instance.new("Part")
     p.Parent = plr.Character
     p.Anchored = true
     p.CanCollide = false
     p.Transparency = 0.1
     p.formFactor = "Symmetric"
     p.Size = Vector3.new(12, 12, 12)
     p.TopSurface = "Smooth"
     p.BottomSurface = "Smooth"
     p.Name = "Sharingan"
     p.Shape = "Ball"
     p.CFrame = plr.Character.Torso.CFrame
     p.BrickColor = BrickColor.new("Crimson")
     for i = 1 , 10 do
      wait(0.05)
      p.Size = p.Size + Vector3.new(-4, -4, -4)
      p.Transparency = p.Transparency + 0.1
      p.CFrame = plr.Character.Torso.CFrame
     end
    p:Remove()

    plr.Character.Humanoid.MaxHealth = 102
    plr.Character.Humanoid.Health = 102
    State1.Enabled = true
    State2.Enabled = false
    State3.Enabled = false
end)

Local Script

local dir = script.Parent.Structure.ScrollingFrame
local e = game:GetService("ReplicatedStorage")
local s = e.StateEvents
local plr = game.Players.LocalPlayer
local hs = plr:WaitForChild("hiddenstats")
local plr = game.Players.LocalPlayer
local d = script.Parent.Structure

-- Buttons
local b1 = dir["1 - Pre PS 1"] -- 1
local b2 = dir["0 - No State"] -- 2
local b3 = dir["2 - Pre PS 2"] -- 3
local b4 = dir["3 - Pure State 1"] -- 4
local b5 = dir["4 - Pure State 2"] -- 5

b1.MouseButton1Click:Connect(function(plr) -- 1
    d.Visible = false
    s.PrePS1:FireServer(plr)
end)
0
Please provide the "local script" that sends the data to the server. tzmods 59 — 5y
0
Ok, I added it Bearturnedhuman 48 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Make sure the script is not in workspace. For some reason, it must be in ServerScriptStorage.

0
Sorry, (I think you did a typo) but it is ServerScriptService, not ServerScriptStorage saSlol2436 716 — 5y
Ad

Answer this question