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

This dialog script does not work in a regular server, but does in studio. Why?

Asked by 6 years ago
Edited 6 years ago

I have this script:

local playerthumb = "https://www.roblox.com/headshot-thumbnail/image?userId=%s&width=420&height=420&format=png"
script.Parent.DialogChoiceSelected:Connect(function(plr, choice)
    print(choice.Name)
    if choice.Name == "GetOffice" then
        local room = findRoom(plr)
        if room then
            local card = game.Lighting.keyTemplate:Clone()
            card.Parent = plr.Backpack
            card.Name = ("[ %s ]"):format(room.Name)
            card = card.Handle
            local front = card.front
            local back = card.back
            front.Frame.BackgroundColor3 = BrickColor.Red().Color
            front.thumb.Image = playerthumb:format(plr.UserId)
            front.name.Text = plr.Name
            front.rank.Text = "Owner"
            wait(0.25)
            game.Chat:Chat(script.Parent.Parent, "Your office is #" .. room.Name:sub(7), Enum.ChatColor.Green)
        else
            wait(0.25)
            game.Chat:Chat(script.Parent.Parent, "Sorry, I cant find a room for you right now", Enum.ChatColor.Red)
        end
    elseif choice.Name == "VisitOffice" then
        local card = game.Lighting.keyTemplate:Clone()
        card.Parent = plr.Backpack
        card.Name = "Visitor Car"
        card = card.Handle
        local front = card.front
        local back = card.back
        front.Frame.BackgroundColor3 = BrickColor.Green().Color
        front.thumb.Image = playerthumb:format(plr.UserId)
        front.name.Text = plr.Name
        front.rank.Text = "Visitor"
    else
        game.Chat:Chat(script.Parent.Parent, "Come back anytime!", Enum.ChatColor.Blue)
    end
    warn("done")
end)

And it works in studio, but not in regular servers.

EDIT: The script's parent is a Dialog with two DialogChoices

EDIT2: Cut down script length

FilteringEnabled = true and StreamingEnabled = false

0
You aren't doing filtering right. When ``FilteringEnabled = True`` , the client cannot touch workspace. All changes happen within that client and not server-wide. However, having a "backend" with remote event/function triggers will solve this issue. http://wiki.roblox.com/index.php?title=Experimental_Mode Sanjay2003 15 — 6y
0
But it's a server script SebbyTheGODKid 198 — 6y
0
Could you cut down the script to a minimal example that shows something that works in studio but not in game? Just being able to do that would probably make the problem obvious. Brouhahaha 27 — 6y
0
done SebbyTheGODKid 198 — 6y
0
and hi Brouhahaha you're following me and ur my favorite admin ;) SebbyTheGODKid 198 — 6y

Answer this question