#ok so i made a script to make a text change when a command is run
1 messages · Page 1 of 1 (latest)
ill type half and half
script 1 :
-- UpdateShowcaseServer (ServerScriptService)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
local EVENT = ReplicatedStorage:WaitForChild("UpdateShowcaseEvent")
-- Allowed users (only these names can change the text)
local ALLOWED = {
["Z6r_r"] = true,
["fvuelz"] = true,
}
-- Locate the Showcase part & TextLabel safely
local function getTitleLabel()
-- case-insensitive findShowcase helper
local function findShowcase()
for _, obj in ipairs(Workspace:GetChildren()) do
if obj:IsA("Model") and obj.Name:lower() == "showcase" then
return obj
end
end
return nil
end
local showcase = findShowcase()
if not showcase then return nil, "Showcase model not found in Workspace" end
local titlePart = showcase:FindFirstChild("TitlePart")
if not titlePart then return nil, "TitlePart not found under Showcase" end
-- find first SurfaceGui child (handles any name)
local surfaceGui = nil
for _, child in ipairs(titlePart:GetChildren()) do
if child:IsA("SurfaceGui") then
surfaceGui = child
break
end
end
if not surfaceGui then return nil, "SurfaceGui not found inside TitlePart" end
-- find the TextLabel
local titleLabel = surfaceGui:FindFirstChild("TitleLabel")
if not titleLabel or not titleLabel:IsA("TextLabel") then
return nil, "TitleLabel (TextLabel) not found inside the SurfaceGui"
end
return titleLabel
end
local function sanitizeText(text)
if type(text) ~= "string" then return "" end
-- trim whitespace
text = text:match("^%s*(.-)%s*$") or ""
-- limit length to prevent overflow (adjust as needed)
if #text > 150 then
text = text:sub(1, 150) .. "..."
end
return text
end
-- Event listener
EVENT.OnServerEvent:Connect(function(player, rawText)
-- Security check on server (MUST have this)
if not player or not player.Name then return end
if not ALLOWED[player.Name] then
warn(player.Name .. " tried to use the Showcase command but is not allowed.")
return
end
local titleLabel, err = getTitleLabel()
if not titleLabel then
warn("Couldn't find TitleLabel: " .. tostring(err))
return
end
local text = sanitizeText(rawText)
titleLabel.Text = text
print(("[Showcase] %s updated the title to: %q"):format(player.Name, text))
end)
1 script 2
-- ChatCommandListener (StarterPlayerScripts LocalScript)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local EVENT = ReplicatedStorage:WaitForChild("UpdateShowcaseEvent")
-- client-side allowed names (just to avoid sending bad requests)
local ALLOWED = {
["Z6r_r"] = true,
["fvuelz"] = true,
}
-- Trim helper
local function trim(s) return s and s:match("^%s*(.-)%s*$") or "" end
-- Chat listener
player.Chatted:Connect(function(msg)
if type(msg) ~= "string" then return end
-- check for leading "!"
if msg:sub(1,1) ~= "!" then return end
-- only allow if the local player is one of the allowed users
if not ALLOWED[player.Name] then
-- optional: show a system chat message (so they know)
pcall(function()
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
Text = "You don't have permission to use the Showcase command.",
Color = Color3.new(1, 0.6, 0.6),
Font = Enum.Font.SourceSansBold,
FontSize = Enum.FontSize.Size18
})
end)
return
end
local raw = msg:sub(2) -- remove the "!"
local text = trim(raw)
if text == "" then
-- optional feedback
pcall(function()
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
Text = "Usage: !your text here",
Color = Color3.new(1, 0.8, 0.4)
})
end)
return
end
-- Fire server (server will re-check permissions)
EVENT:FireServer(text)
end)
and yes in replicated storage i put "UpdateShowcaseEvent
but it doesnt work?
even tho it all seems correct
anyone pls help
Try debugging to identify where your script is breaking
no output or anything
when command is run
are you new at scripting?
look like it doesn't print or warn any thing because when you make a return condition like if...return nil, "..." you doesn't make any output function like print() or warn()
I'm assuming so since the script he sent is ai.
idk maybe 75%
lots of bug and some "dumb" function he made
but i dont think he's use ai
I'm pretty sure it's ai due to the comments
ig he's just copy and paste the ai script and make some stuff with that script
Comments from AI are usually in other places
I mean, he might have just got it from some crappy youtube video as well, which would explain the random minor errors
I think he just got this script from youtube or any open source resource
Oh yeah, I completely forgot to actually help him. Outside of a slight typo where you forget "_" near the beginning, the reason this doesn't work is because player.Chatted doesn't fire on the client
Anyways, I was too lazy to actually make it any good, but after moving around and removing some of what was already there, I got a working version. Just remove your local script, and replace the normal script's contents with this and it should work:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local EVENT = ReplicatedStorage:WaitForChild("UpdateShowcaseEvent")
-- Allowed users (only these names can change the text)
local ALLOWED = {
["Z6rr"] = true,
["fvuelz"] = true,
}
-- Locate the Showcase part & TextLabel safely
local function getTitleLabel()
-- case-insensitive findShowcase helper
local function findShowcase()
for _, obj in ipairs(Workspace:GetChildren()) do
if obj:IsA("Model") and obj.Name:lower() == "showcase" then
return obj
end
end
return nil
end
local showcase = findShowcase()
if not showcase then return nil, "Showcase model not found in Workspace" end
local titlePart = showcase:FindFirstChild("TitlePart")
if not titlePart then return nil, "TitlePart not found under Showcase" end
-- find first SurfaceGui child (handles any name)
local surfaceGui = nil
for _, child in ipairs(titlePart:GetChildren()) do
if child:IsA("SurfaceGui") then
surfaceGui = child
break
end
end
if not surfaceGui then return nil, "SurfaceGui not found inside TitlePart" end
-- find the TextLabel
local titleLabel = surfaceGui:FindFirstChild("TitleLabel")
if not titleLabel or not titleLabel:IsA("TextLabel") then
return nil, "TitleLabel (TextLabel) not found inside the SurfaceGui"
end
return titleLabel
end
-- Event listener
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if typeof(msg) ~= "string" then return end
-- check for leading "!"
if msg:sub(1,1) ~= "!" then return end
-- only allow if the local player is one of the allowed users
if not ALLOWED[player.Name] then
-- optional: show a system chat message (so they know)
return
end
local raw = msg:sub(2) -- remove the "!"
local text = raw
local titleLabel, err = getTitleLabel()
if not titleLabel then
warn("Couldn't find TitleLabel: " .. tostring(err))
return
end
titleLabel.Text = text
print(("[Showcase] %s updated the title to: %q"):format(player.Name, text))
end)
end)
you can use '''lua
--Your code
'''
to look more format with code
I'm aware. I purposefully didn't do it for this because it had to be split into multiple messages and would've ended up with weird gaps if I did
this
yeah i used youtube for it
** You are now Level 1! **