What do you want to achieve? Change text when clicked,
What is the issue? It doesnt let me change text.
What solutions have you tried so far? I looked all and tried all but nothing worked.
ServerScriptService
local AdminEvent = game:GetService("ReplicatedStorage").AdminRemote
AdminEvent.OnServerEvent:Connect(function(player, canJump)
print(canJump)
if canJump == true then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 0
end
elseif canJump == false then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 30
end
end
end)
You can’t use local player in a server script. If it’s in the same server script as above, try this:
local AdminEvent = game:GetService("ReplicatedStorage").AdminRemote
AdminEvent.OnServerEvent:Connect(function(player, canJump)
print(canJump)
if canJump == true then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 0
end
elseif canJump == false then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 30
end
end
player.PlayerGui.ScreenGui.Change.Text = "LOL"
end)
I see that your post has been solved, but you should really consider adding some more security to this remote event. Perhaps simply checking if the player is an admin before doing things inside the admin event?
I Completely agree, at least a simple check if the userId of the player is that of an admin. Right now an exploiter can fire the event with whatever canjump value and be an “admin”
nameA = {"1101sky21e"}
plr = script.Parent.Parent.Parent
for i = 1, #nameA do
if plr:GetRankInGroup(13566661)>=8 or plr.Name == nameA[i] then
print(plr.Name "passed")
else script.Parent:remove()
end
end
local AdminEvent = game:GetService("ReplicatedStorage").AdminRemote
local Admins = {1801038879}
AdminEvent.OnServerEvent:Connect(function(player, canJump)
if table.find(Admins, player.UserId) == nil then return warn("EXPLOITER") end
print(canJump)
if canJump == true then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 0
end
elseif canJump == false then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 30
end
end
player.PlayerGui.ScreenGui.Change.Text = "LOL"
end)
Trust me, they can just use FireServer on any RemoteEvent. Simply just check if the player who called the event, is in your group and at a high enough rank!
Keep that there, that will check if the person that called the event is an admin, right now you are the only admin, so if someone else calls that, a warning in the output will be logged and the event will not continue
local AdminEvent = game:GetService("ReplicatedStorage").AdminRemote
local Admins = {1801038879}
AdminEvent.OnServerEvent:Connect(function(player, canJump)
if table.find(Admins, player.UserId) == nil then return warn("EXPLOITER") end
print(canJump)
if canJump == true then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 0
end
elseif canJump == false then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 30
end
end
**player.PlayerGui.ScreenGui.Change.Text = "LOL"**
end)
I want to add text to true one but it makes eroor.
The part ** line.
local AdminEvent = game:GetService("ReplicatedStorage").AdminRemote
local Admins = {1801038879}
AdminEvent.OnServerEvent:Connect(function(player, canJump)
if table.find(Admins, player.UserId) == nil then return warn("EXPLOITER") end
print(canJump)
if canJump == true then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 0
end
elseif canJump == false then
print(canJump)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
v.Character:FindFirstChild("Humanoid").JumpPower = 30
end
end
**player.PlayerGui.ScreenGui.Change.Text = "LOL"**
end)
I want to add player.PlayerGui.ScreenGui.Change.Text = “LOL” to if canJump == true then But it makes error.
local remote = game.ReplicatedStorage.AdminRemote
local admins = {
1801038879, -- YourSkyDev
}
local defaultjump = Instance.new("Humanoid").JumpPower -- i forgor the default x
remote.OnServerEvent:Connect(function(invoker, jumpsetting)
if table.find(admins, invoker.UserId) then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
if char then
char.Humanoid.JumpPower = jumpsetting and defaultjump or 0
end
player.PlayerGui.ScreenGui.Change.Text = not jumpsetting and "LOL" or ""
end
else
invoker:Kick("Invalid permission to use remote.")
warn(invoker, "has tried to invoke Admin Event with no permission.")
end
end)