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

How do i make Players Not Copy Each other with F.E Scripts?

Asked by
Jirozu 71
7 years ago

So, i recently learned how to use F.E, but there is a problem. If One Player does a certain action, anybody in the server also does the same action, Is there something wrong with my script?

Local Script:

--\\Player Variables
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character or Player.Character.Parent
local Charater = Player.Character
local UserInputService = game:GetService("UserInputService")

--Variables
local MoveLocked = false

--Stop Hitting Yourself!: Strength Level 5, 1st Move 
UserInputService.InputBegan:connect(function(input, gameProcessed)
    if input.KeyCode ~= Enum.KeyCode.Z then return end;
    if gameProcessed then
    else
        if MoveLocked == false then
            MoveLocked = true
            game.ReplicatedStorage.RemoteEvents.BrainwashMoveEvent:FireServer()
            wait(math.random(4, 8))
            MoveLocked = false
        end
    end
end)

Script:

--Player Variables
local Player = script.Parent.Parent.Parent
repeat wait() until Player.Character or Player.Character.Parent
local Character = Player.Character

--Variables
local CanBrainWash = true

--Stop hitting yourself!
game.ReplicatedStorage.RemoteEvents.BrainwashMoveEvent.OnServerEvent:connect(function(Player)
    if CanBrainWash == true then
        CanBrainWash = false
        game:GetService("Chat"):Chat(Character.Head, "I've faced stronger people than you.")
        --Radius
        local Radius = Instance.new("Part", game.Workspace)
        Radius.Anchored = true
        Radius.CanCollide = false
        Radius.Size = Vector3.new(25, 25, 25)
        Radius.Transparency = 1
        Radius.CFrame = Character.LowerTorso.CFrame
        --If Enemeny is inside radius
        local ten = true
        Radius.Touched:connect(function(hit)
            if not ten then return end;
            ten = false
            local ehum = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
            if ehum and ehum ~= Character.Humanoid then
                game:GetService("Chat"):Chat(hit.Parent.Head, "What did you say??!?!?!")
                ehum.WalkSpeed = ehum.WalkSpeed-16
                --Player Responds
                wait()
                game:GetService("Chat"):Chat(Character.Head, "Hehe..Good, Now Hit yourself.")
                --Enemeny Responds
                wait(0.4)
                game:GetService("Chat"):Chat(hit.Parent.Head, "...Yes Master.")
                ehum:TakeDamage(Player.Data.Mastery.Value+4)
                wait(3)
                --Enemeny Snaps out of it
                game:GetService("Chat"):Chat(hit.Parent.Head, "What happened..?")
                ehum.WalkSpeed = ehum.WalkSpeed+16
            end
            wait(0.5)
            Radius:Remove()
            CanBrainWash = true
        end)
    end
end)

Answer this question