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 local test but not with filtering enabled?

I'm trying to make a quest like script. I don't know why, but this script doesn't work with filtering enabled. How come? I know what filtering is, but is it something the server can't access or what?

function check(Player, Choice)
if Choice.Name == "DialogChoice1" then
if Player.Backpack:FindFirstChild("GravityCoil") == nil then
    print ("No G Coil")
    script.Parent.DialogChoice.UserDialog = "Okay, Bye!"
    script.Parent.DialogChoice.ResponseDialog = "See ya later!"
else
    print ("G coil found!")
    script.Parent.DialogChoice.UserDialog = "I have the coil."
    script.Parent.DialogChoice.ResponseDialog = "You actually got it??? Thanks a ton! Here's a reward!"
    wait(2.5)
    local rs = game:GetService("ReplicatedStorage")
    local clone = rs.Tape:Clone()
    clone.Parent = Player.Backpack
    Player.Backpack.GravityCoil:Remove()
end
end
end

4 comments

0

I would use an SendNotification CoreGUI when player enters the area, http://wiki.roblox.com/index.php?title=API:Class/StarterGui/SetCore

0

Is this a server script?

0

Also try putting the rs:WaitForChild("Tape"):Clone() on line 13

0

WaitForChild doesn't fix the problem

1 answer

###Probably will not help but I fixed this script up. I had to ._. Make sure it's a server script or else it doesn't work.

local function check(Player, Choice)
    if Choice.Name == "DialogChoice1" then
        if not Player.Backpack:FindFirstChild("GravityCoil") then
            print("No G Coil")
            script.Parent.DialogChoice.UserDialog = "Okay, Bye!"
            script.Parent.DialogChoice.ResponseDialog = "See ya later!"
        else
            print("G coil found!")
            script.Parent.DialogChoice.UserDialog = "I have the coil."
            script.Parent.DialogChoice.ResponseDialog = "You actually got it??? Thanks a ton! Here's a reward!"
            wait(2.5)
            local rs = game:GetService("ReplicatedStorage")
            local clone = rs.Tape:Clone()
            clone.Parent = Player.Backpack
            Player.Backpack.GravityCoil:Destroy() -- :Remove is deprecated, use :Destroy
        end
    end
end

script.Parent.DialogChoiceSelected:Connect(check) -- under your dialog object

1 comment

0

It is a server script and do you have any idea why this doesn't work?

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