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

What could be wrong with this script? I am adding this part so it is specific.

Asked by 4 years ago

So my goal is to use this script to make it so that when you click on a button, an event is fired. That event could make a bunch of options happen. Here is the script: Local script in gui:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("RemoteEvent")

script.Parent.MouseButton1Down:connect(function(billnye)
    script.Parent.Parent.Person.Value = script.Parent.Parent.b.Text
    script.Parent.Parent.Parent.yesgui.a.Visible = false
    script.Parent.Parent.Parent.yesgui.b.Visible = false
    script.Parent.Parent.Parent.yesgui.c.Visible = false
    script.Parent.Parent.Parent.yesgui.d.Visible = false
    event:FireServer(script.Parent.Parent.Parent.Attack.ScrollingFrame.AttackDone.Value, game.Workspace:FindFirstChild(game.StarterGui.yesgui.Person.Value), game.Players:FindFirstChild(game.StarterGui.yesgui.Person.Value))
end)

The variables are values that define what you want to happen to other players, one also has the player name that they want to attack.

ServerScriptService script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("RemoteEvent")

local function yesgogo(attack, playerokay, playerokayplay)
    if attack == "Kill" then
        playerokay.Humanoid.Health = 0
    end
    if attack == "Speed" then
        playerokay.Humanoid.WalkSpeed = 100
    end
    if attack == "Slow" then
        playerokay.Humanoid.WalkSpeed = 3
    end
    if attack == "Jail" then
        local jailCopy = game.Workspace.AdminAssets.Jail:Clone()
        jailCopy.Parent = game.Workspace
        jailCopy.Transparency = 0
        jailCopy.CanCollide = true
        jailCopy.Position = Vector3.new(playerokay.HumanoidRootPart.Position.X, playerokay.HumanoidRootPart.Position.Y, playerokay.HumanoidRootPart.Position.Z)
    end
    if attack == "LevelOP" then
        playerokayplay.leaderstats.Level.Value = 100
    end
    if attack == "Reset" then
        playerokayplay.leaderstats.Level.Value = 1
    end
end

event.OnServerEvent:Connect(yesgogo)

I don't know why these don't effect the player. Please help. Thank you.

0
try using math.random and assigning each event to 1 number coolmanHDMI 72 — 4y
0
Just a quick note here, variables are supposed to make it easy to understand what they represent, are you sure your variable choice does that? SteamG00B 1633 — 4y
0
Could you use more meaningful variables? CrypxticDoge 135 — 4y
0
I should explain what this is for, so I am making admin commands but instead of using it threw chat I am using it threw a gui. When the admin button is clicked options show up. The variables represent the options. After that you type in the player you want to effect. That is another variable. But when I click the kill option and try to use it, it does not work. I don't know why. Mrawzomeperson -3 — 4y

Answer this question