Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script works in studio but not in-game? Please help, as I've been trying to figure this out.

Alright, I will explain this briefly. Basically, I experiment generally with scripts, yet, I never really got around to figuring this out. I've been trying for the past couple of days trying to fix it. Anyway, I'll show you the script now, and I'll explain what its purpose is.

wait (0.5)
msg1 = script.Parent

msg1.Touched:connect(function(hit)

game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
Text = "text test";
Color = Color3.new(255/255, 215/0, 0/0);
FontSize = Enum.FontSize.Size24;
})
wait(2)
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
Text = "text test2";
Color = Color3.new(255, 255, 255);
FontSize = Enum.FontSize.Size24;
})
wait(2)
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
Text = "text test 3";
Color = Color3.new(255, 255, 255);
FontSize = Enum.FontSize.Size24;
})
end)

Basically, what it is supposed to do, is when you step on a brick (I named this brick msg1) makes it so when you touch something with your body part, it will initiate a piece of code in the ROBLOX integrated chat.

I may as well also add that FilteringEnabled is off, just in case. I appreciate any help :)

7 comments

0

Hmm, have you tried a localscript? I can't really answer the question, only offer tips on what you can do.

0

Yes, I've tried a LocalScript.

0

http://wiki.roblox.com/index.php?title=API:Class/StarterGui/SetCore , You my friend are using a Script to call SetCore: ...

0

I'll read that, thank you.

0

Touched events work only in Scripts while SetCore: works only in modulescripts or localscripts

0

If you could post a fix that'd be amazing. I'll figure out on my own if not, though. Thank you for your help.

0

As in a fix, a variation of my script fixed.

1 answer

Hello,

Script, Inside of part...

msg1 = script.Parent

msg1.Touched:connect(function(hit)
	local client = game.Players:GetPlayerFromCharacter(hit.Parent)
	local remote = script.Remote
	if client then
	remote:FireClient(client,"TEXT1",Color3.new(1,0,0),Enum.FontSize.Size24)
	wait(2)
	remote:FireClient(client,"TEXT2",Color3.new(1,1,1),Enum.FontSize.Size32)
	wait(2)
	remote:FireClient(client,"TEXT3",Color3.new(0,0,0),Enum.FontSize.Size18)
	end
end)

Note : if you want to change text for all players , it must be like this...

remote:FireAllClients("TEXT3",Color3.new(0,0,0),Enum.FontSize.Size18)

Localscript, inside of StarterPack...

local remote = workspace.Part1.Script.Remote

function SetCoreMessage(tex,c,size)
		local set = game:GetService("StarterGui")
			set:SetCore("ChatMakeSystemMessage",{
			Text = tex,
			Color = c,
			FontSize = size })
			--print("SUCCESS")
	end

remote.OnClientEvent:Connect(function(t,cl,s)
	SetCoreMessage(t,cl,s)
end)
-workspace
--Part1
---Script
----Remote

Thank you for reading! Wish you goodluck!

This discussion is preserved as it was. New answers, comments, and votes are closed.