I want to create a simple system that will send text in the chat if a player says a specific word.
The main system (called MainFrame) which detects messages and does a task related to that word works fine, but I am struggling with the separate script located in StarterPlayerScripts (called SCMmain) which sends messages in the chat, I would want the SCMmain script to repeat itself once every time MainFrame requests it, the SCMmain script says whatever is in it’s StringValue, so the new message is put there by the MainFrame before the SCMmain script is repeated.
I have tried many solutions, attempting to create a BoolValue which would either enable or disable the script but I could not implement it correctly, either wouldn’t stop looping the message or ignore the change in the StringValue. I can imagine there is a possibility of somehow making that work, otherwise making the SCMmain say the message in StringValue every time it detects that it has been changed, or make it reset and repeat when MainFrame requests it, but this is only my speculation as I don’t really know much programming. Or just I am making this completely wrong and there is a better way of making it.
MainFrame code:
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == "hello" then
game.StarterPlayer.StarterPlayerScripts.SCMmain.Value1.Value = "Hello";
end
end)
end)
SCMmain code:
bc = BrickColor.new(255,255,255)
script.Sound:Play()
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = script.Value1.Value;
Font = Enum.Font.SciFi;
Color = bc.Color;
FontSize = Enum.FontSize.Size96;
})
Doing the chat messages should be on client. Make sure it’s a localscript. I’d reccomend using Color3.fromRGB and not BrickColor.new() for that. Use remote events to communicate with the client from server.
You are editing the value inside the localscript in playerscripts(which is repliacted to the client), not the actual “PlayerScripts” thing inside the player which gets replicated to inside the player itself.
I see, so that is the reason why I could not interact with the script the whole time? I will try to do all of that but I am not sure if I’m understanding everything.
I changed the scripts to these, and also replaced the brick color with Color3.fromRGB, the SCMmain script is a local script, where should I move the SCMmain script to make it work instead of being replicated?
you should use remoteevents but il give you a cheap fix until you can get to them to do it properly.
MainFrame Script:
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == "hello" then
player.PlayerScripts.SCMmain.Value1.Value = "Hello";
end
end)
end)
SCMain Script:
script.Value1:GetPropertyChangedSignal("Value"):Connect(function()
bc = Color3.fromRGB(255,255,255)
script.Sound:Play()
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = script.Value1.Value;
Font = Enum.Font.SciFi;
Color = bc;
FontSize = Enum.FontSize.Size96;
})
end)
You don’t know the basics on Roblox Studio do you? I suggest you take a step back and learn what the platform is all about. Learn Roblox | Studio Basics
local player = game.Players.LocalPlayer
player.Chatted:Connect(function(msg)
if string.lower(msg) == "hello" then
script.Sound:Play()
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = msg;
Font = Enum.Font.SciFi;
Color = Color3.fromRGB(255,255,255);
FontSize = Enum.FontSize.Size96;
})
end
end)
no server script, paste into SC local script or whatever you named it
It did make it work actually! I am thankful for help, though I will get myself acknowledget with the programming part of Roblox Studio better for sure.