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

Why isn't MouseClick working?

Asked by
wrenzh 65
10 years ago

First, code:

01script.Parent.ClickDetector.MouseClick:connect(function(player)
02    print("clicked! by player " .. player.Name)
03    for _, v in pairs(player.Character:GetChildren()) do
04        print("iterating through player")
05        if v:IsA("Shirt") then
06            print("found shirt at " .. v:GetFullName() .. " with current ShirtTemplate " .. v.ShirtTemplate)
07            v.ShirtTemplate = script.Parent.Parent.Shirt.ShirtTemplate
08            print("changed shirt at " .. v:GetFullName() .. " to ShirtTemplate " .. v.ShirtTemplate)
09        elseif v:IsA("Pants") then
10            print("found pants at " .. v:GetFullName() .. " with current PantsTemplate " .. v.PantsTemplate)
11            v.PantsTemplate = script.Parent.Parent.Pants.PantsTemplate
12            print("changed pants at " .. v:GetFullName() .. " to PantsTemplate " .. v.PantsTemplate)
13        end
14    end
15end)

This script is placed inside the Torso of a Humanoid model wearing a Shirt and Pants. My aim is to have the player click the Torso to put on the clothes.

It's as if the event isn't even firing - the first print statement doesn't show up in the console in online mode, whereas in Play Solo mode it functions fine.

It's in a Script, and Filtering is enabled.

I'm very puzzled right now. Any and all help would be greatly appreciated.

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
10 years ago

Is there a clickdetector in the Torso online? That's the only explanation for this to not be working.

-Goulstem

0
I inserted it in Studio. Unless it was removed when the place was uploaded, yes, it is there. wrenzh 65 — 10y
0
Well check somehow, like when a player joins check if the clickdetector is there and print something, and you can see the print using F9 I think .. or F4? Lol one of th Fs. But other than that theres nothing wrong with your script exceptf for maybe efficiency. Goulstem 8144 — 10y
0
That's not it. I tried (redundantly) adding a line at the top of the script creating another ClickDetector. Still doesn't work, wrenzh 65 — 10y
0
Well I really don't know /: Goulstem 8144 — 10y
Ad

Answer this question