wdym?
So I change ‘speed’ to the textbox’s name (value)?
did so,still broken
I think it’s because of me being stupud not knowing what to do with HugeCoolBoy’s suggestion
Edit:So stupid that I didn’t even spell it right
I think it might be because the local value variable is assigned to the old .Text or the .Text that is not set by the player yet, maybe try adding a new parameter in the remote that sends the updated .Text value
(( Just like hugecoolboy’s remote example below ))
-- the client::
-- how you should do it:
RemoteEvent:FireServer(target, TextBox.Text)
Your server should look like:
local repStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local Event = repStorage:WaitForChild("Speed")
Event.OnServerEvent:Connect(function(plr, targetName, speed)
local target = players:FindFirstChild(targetName)
if target then --check for the player (again cuz the check on the client is bypassable with exploits)
local char = plr.Character
if char then
local hum = char:FindFirstChildOfClass("Humanoid")
if hum then
hum.WalkSpeed = tonumber(speed) -- sets the speed
end
end -- Your script to kill here (target is the player to kill)
print(plr.Name .. " speed " .. targetName)
end
end)
Im still confused…Sorry if I’m annoying
It’s fine, you’re not annoying. What issue are you having in particular?
wdym by this
btw somehow this script messes up with another command of mine but let’s solve things one by one
Basically, it’s just showing that you have to fire the remote event the target’s name and the speed box’s text. Judging by your original server script, your client code should look something like this:
local plrGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
game:GetService("ReplicatedStorage").Speed:FireServer(targetName, plrGui.Admin2.Commands.Value.Text)
You probably structured it differently but this is just to show what the setup could look like.
so is this a script I put anywhere?
Add it to the pre-existing code that you use to send the event.
local repStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local Event = repStorage:WaitForChild("Speed")
Event.OnServerEvent:Connect(function(plr, targetName, speed)
local target = players:FindFirstChild(targetName)
if target then --check for the player (again cuz the check on the client is bypassable with exploits)
local char = plr.Character
if char then
local hum = char:FindFirstChildOfClass("Humanoid")
if hum then
hum.WalkSpeed = tonumber(speed) -- sets the speed
local plrGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
game:GetService("ReplicatedStorage").Speed:FireServer(targetName, plrGui.Admin2.Commands.Value.Text)
end
end -- Your script to kill here (target is the player to kill)
print(plr.Name .. " speed " .. targetName)
end
end)
right?
In what script do you fire the remote event?
No, add it to the local script that you use to send the event.
the one in SSS(ServerScriptService)
You can not fire a remote in the same script where you detect it…
local repStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local Event = repStorage:WaitForChild("Speed") -- you can also use just an event for all the commands
local list = script.Parent.Commands.List
local Group = script.Parent.Commands
local freezeBtn = Group.Speed -- speed button
local target = ""
local plrGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
game:GetService("ReplicatedStorage").Speed:FireServer(target, plrGui.Admin2.Commands.Value.Text)
freezeBtn.MouseButton1Click:Connect(function()
if players:FindFirstChild(target) then --check for the player
Event:FireServer(target)
else
print("Invalid Name")
end
end)
for _, v in pairs(list:GetChildren()) do
if v:IsA("TextButton") then
v.MouseButton1Click:Connect(function()
target = v.Text
local selectionColor = Color3.fromRGB(255, 0, 0) --pick the color you want
local defaultColor = Color3.fromRGB(255, 255, 255) --pick the current color
for _, i in pairs(list:GetChildren()) do
i.BackgroundColor3 = defaultColor
end
v.BackgroundColor3 = selectionColor
end)
end
end
right?
This should work.
local players = game:GetService("Players")
local plrGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local list = script.Parent.Commands.List
local Group = script.Parent.Commands
local freezeBtn = Group.Speed -- speed button
local target = ""
freezeBtn.MouseButton1Click:Connect(function()
if players:FindFirstChild(target) then --check for the player
game:GetService("ReplicatedStorage").Speed:FireServer(target,plrGui.Admin2.Commands.Value.Text)
else
print("Invalid Name")
end
end)
for _, v in pairs(list:GetChildren()) do
if v:IsA("TextButton") then
v.MouseButton1Click:Connect(function()
target = v.Text
local selectionColor = Color3.fromRGB(255, 0, 0) --pick the color you want
local defaultColor = Color3.fromRGB(255, 255, 255) --pick the current color
for _, i in pairs(list:GetChildren()) do
i.BackgroundColor3 = defaultColor
end
v.BackgroundColor3 = selectionColor
end)
end
end
I might have typed the wrong text,it should be SpeedBtn but doesn’t matter
First, make sure it sends the remote after the player changes his speed value
Yes.
freezeBtn.MouseButton1Click:Connect(function()
if players:FindFirstChild(target) then --check for the player
Event:FireServer(target, script.Parent.Parent.Commands.Value.Text) -- fire the target and the speed
else
print("Invalid Name")
end
end)