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

I cant see the problem? (Position is not a valid member of LocalScript)

Asked by 5 years ago
Edited 5 years ago

So i was trying to make a custom chat, there are 2 scripts, the other in ServerScriptService is working alright, but the script inside the chat is not, its the script that shows the message.

SCRIPTS:

The Faulty Script:

01local Player = game.Players.LocalPlayer
02local OriginalText = "Click here or press '/' to send a message"
03local Chat = script.Parent
04local ChatFrame = script.Parent.MainCustomChatWindow
05local ChatBar = script.Parent.MainCustomChatWindow.SendChatFrame.PlayerSendBox
06local Frame = script.Parent.MainCustomChatWindow.PlayerTextBoxHolder
07local UIS = game:GetService("UserInputService")
08if UIS.TouchEnabled then
09    OriginalText = OriginalText
10    ChatBar.Text = OriginalText
11end
12UIS.InputBegan:Connect(function(Input, GameProcessed)
13    if GameProcessed then return end
14    if Input.KeyCode == Enum.KeyCode.Slash then
15        ChatBar:CaptureFocus()
View all 78 lines...

It is inside the ScreenGui of the Chat, not inside the ChatFrame so script.Parent = ScreenGui

It is probably cloning itself and trying to find Position on it, which does not exist but I don't know how to fix it or why it is happening

It is having errors at line 75: l.Position = UDim2.new(0,0, (c-1)*0.1,0)

This is a LocalScript

And the other script:

01local ReplicatedStorage = game.ReplicatedStorage
02local MessageEvent = ReplicatedStorage.Message
03local APrefix = [[/]]
04local Owners = {"166660143", "260932086"}
05local Admins = {"166660143", "260932086", "1466856081", "310333010"}
06local function IsOwner(p)
07    local n = p.UserId
08    for _,v in pairs(Owners) do
09        if v == n then
10            return true
11        end
12    end
13    return false
14end
15local function isAdmin(p)
View all 76 lines...

Which appears to have no errors at all and is a normal Script

1 answer

Log in to vote
0
Answered by
Y_VRN 246 Moderation Voter
4 years ago

Try this, starting on line 73:

1    for c,v in pairs(t) do
2    if v:IsA("GuiObject") then -- checks if it is a gui object.
3    local l = v:Clone()
4        l.Position = UDim2.new(0,0, (c-1)*0.1,0)
5        l.Parent = Frame
6end
7end

This checks if the value returned in "v" is an Instance that is a GuiObject (basically a TextBox, a TextLabel, anything, whether it is 3D or 2D)

I assume this is because you have other scripts in the frame? (I might be wrong.)

Ad

Answer this question