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

Roblox Studio output bar not printing anything from local scripts, why?

Hi, So I'm unsure if this post counts on this website as It's about code, so let me know if it's unwelcome. Anyways, I have an issue with Roblox studio in general, The output bar is printing no errors or print statements from local scripts. It prints just fine from a Server script, as I've tested that. Here is the code I'm running, nothing is printing or giving me errors.

local plr = game.Players.LocalPlayer
local hum = plr.Character.Humanoid
print("Running")
script.Parent.Touched:Connect(function(hit)
	print(hit)
	if hit.Parent:WaitForChild("Humanoid") == true then
		print("bruh")
	end
end)

How can I fix this so I get output from a local script? Thanks!

I should mention that I am in collaborative editing, I'm the owner. This has happened to me before in solo editor games so I don't think that's the issue, but I figured I'd add that here.

5 comments

0

Where is the local script placed in your game

0

Starter Character Scripts

0

And one is in a Part, It's all Local Scripts by the way.

0

Why do you have script.Parent.Touched in Starter Character Scripts?

0

That script is not in starter character scripts, it's in The part

3 answers

✓ Accepted answer

Local scripts located in the workspace do not run. You gotta put it somewhere in the player.

1 comment

0

Oh I see, Thank you!

Use ~= nil instead of == true

local plr = game.Players.LocalPlayer
local hum = plr.Character.Humanoid
print("Running")
script.Parent.Touched:Connect(function(hit)
    print(hit)
    if hit.Parent:WaitForChild("Humanoid") ~= nil then
        print("bruh")
    end
end)

2 comments

0

The scrip is not an issue. The issue is that my scripts dont print errors or any print statements.

0

Funny, he doesn't know the answer yet he'll teach you why your answer is wrong. Haha!

I'm not sure if this is the issue, but the local script with the .Touched event MUST be a descendant of the player. If the script with .Touched is inside the part then it wont work. I recommend putting this script inside of the player, and then referencing the part seperately.

local plr = game.Players.LocalPlayer
local hum = plr.Character.Humanoid
local part = workspace.(PART)
print("Running")
part.Touched:Connect(function(hit)
    print(hit)
    if hit.Parent:WaitForChild("Humanoid") == true then
        print("bruh")
    end
end)

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