I recently finished scripting an npc in my game, he’s meant to take you to a different part of the map when talked to. Today I brought my friend on to show him the game since he was interested, but this script seems like it doesn’t even “turn on” for him. I also tried this with another friend, and it didn’t work for them either.
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Shop = game.Workspace.MapItself:WaitForChild("CrenacDock")
local Craan = Shop:WaitForChild("Craan")
local TalkPart = Craan:WaitForChild("TalkPart")
local Humanoid = Craan.Humanoid
local AnimFolder = Craan.Animations
local Idle = Humanoid:LoadAnimation(AnimFolder.Idle)
local Camera = game.Workspace.Camera
local ButtonPressed = ""
Idle:Play()
local Options = script.Parent.Options
local NothingButton = Options.Nothing
local VisitIslandofCalamity = Options.VisitIslandofCalamity
NothingButton.MouseButton1Click:Connect(function() -- These functions don't even work when my friend clicks on these buttons.
print("Nothing Clicked")
ButtonPressed = "Nothing"
end)
VisitIslandofCalamity.MouseButton1Click:Connect(function() -- This one doesn't work as well.
print("VisitIslandofCalamity Clicked")
ButtonPressed = "VisitIslandofCalamity"
end)
TalkPart.ProximityPrompt.Triggered:Connect(function(player) -- Although this function does work.
ButtonPressed = ""
TalkPart.ProximityPrompt.Enabled = false
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = Craan.CameraPart.CFrame
Character.Head.Anchored = true
script.Parent.Enabled = true
local done = false
local function typewrite(label, text, waitingTime)
for i = 1, #text do
label.Text = string.sub(text, 1, i)
wait(waitingTime)
end
done = true
end
done = false
typewrite(script.Parent.TextBackground.TextLabel, "What do you want?", .06)
repeat wait() until done == true
script.Parent.Options.Visible = true
repeat wait() until ButtonPressed ~= ""
-- And I believe this is where it just stops, as the button functions above don't fire.
if ButtonPressed == "VisitIslandofCalamity" then
print("Recieved VisitIslandofCalamity")
local Suits = game.ReplicatedStorage.Craan.RequestSuits:InvokeServer()
print(Suits)
local DarkSuit = false
for i, v in pairs(Suits) do
print(i, v)
if v == "DarkSuit" then
DarkSuit = true
end
end
if DarkSuit == true then
script.Parent.Options.Visible = false
ButtonPressed = ""
done = false
typewrite(script.Parent.TextBackground.TextLabel, "Crenac, huh? Your choice, not mine.", .06)
repeat wait() until done == true
wait(1)
----------------------- Teleport code goes here --------------------------------------
local ScreenGui = player.PlayerGui.ScreenUI
local TeleportUI = ScreenGui.CrenacTeleportUI
TeleportUI.Visible = true
TeleportUI:TweenPosition(UDim2.new(.5, 0,0.5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine, .8)
wait(2)
Character.Humanoid.Sit = false
ScreenGui.Corruption.Visible = true
wait(.2)
Character.HumanoidRootPart.CFrame = game.ReplicatedStorage.CrenacBoat.TeleportBrick.CFrame
TeleportUI:TweenPosition(UDim2.new(0.5, 0,1.5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine, .8)
TalkPart.ProximityPrompt.Enabled = true
Camera.CameraType = Enum.CameraType.Custom
script.Parent.Enabled = false
Character.Head.Anchored = false
else
script.Parent.Options.Visible = false
ButtonPressed = ""
done = false
typewrite(script.Parent.TextBackground.TextLabel, "Kid, you don't even have the gear to go to the island, so don't bother.", .06)
repeat wait() until done == true
wait(1)
TalkPart.ProximityPrompt.Enabled = true
Camera.CameraType = Enum.CameraType.Custom
script.Parent.Enabled = false
Character.Head.Anchored = false
game.ReplicatedStorage.ClientNotifEvent:FireServer("", "You need the Dark Suit to go to the Island of Calamity.")
game.ReplicatedStorage.ClientSendChatMessage:FireServer("You need to obtain the Dark Suit to go to the Island of Calamity.")
end
elseif ButtonPressed == "Nothing" then
print("Recieved Nothing")
script.Parent.Options.Visible = false
done = false
typewrite(script.Parent.TextBackground.TextLabel, "Scat.", .06)
repeat wait() until done == true
wait(.5)
TalkPart.ProximityPrompt.Enabled = true
Camera.CameraType = Enum.CameraType.Custom
script.Parent.Enabled = false
Character.Head.Anchored = false
end
end)
Thank you.