Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago

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 :)

0
Hmm, have you tried a localscript? I can't really answer the question, only offer tips on what you can do. TruDevek 40 — 6y
0
Yes, I've tried a LocalScript. SlammingBird 0 — 6y
0
http://wiki.roblox.com/index.php?title=API:Class/StarterGui/SetCore , You my friend are using a Script to call SetCore: ... arshad145 392 — 6y
0
I'll read that, thank you. SlammingBird 0 — 6y
View all comments (3 more)
0
Touched events work only in Scripts while SetCore: works only in modulescripts or localscripts arshad145 392 — 6y
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. SlammingBird 0 — 6y
0
As in a fix, a variation of my script fixed. SlammingBird 0 — 6y

1 answer

Log in to vote
0
Answered by
arshad145 392 Moderation Voter
6 years ago

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!

Ad

Answer this question