Hello, I have been working on an NPC dialogue system for my game. I used a server script and collection service to tag the NPCS, and when a player interacts, the server sends the NPC name to the client. I get no errors, and everything prints, but for some reason the tweens just aren’t playing. Does anyone have an idea as to what i couldve done wrong? Thanks!
local repStorage = game:GetService("ReplicatedStorage")
local tweenServ = game:GetService("TweenService")
local cam = game.Workspace.Camera
local dialogueModuelScript = require(repStorage.DialogueInformation)
local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait()
local plrGui = plr.PlayerGui
local reponseBox = plrGui.Dialogue.responseBox
local dialogueBox = plrGui.Dialogue.dialogueBox
local dialogueText = dialogueBox.dialogue.Text
local response1Text = reponseBox.reponse1.Text
local response2Text = reponseBox.response2.Text
local response3Text = reponseBox.response3.Text
-----------------------------------------TWEEN STUFF
local dialogueInTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Elastic, Enum.EasingDirection.In, 0, false, 0)
local dialogueOutTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out, 0, false, 0)
local responseInTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local responseOutTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local dialogueOutProperties = {
Position = UDim2.new(4,0,0.78,0)
}
local dialogueInProperties = {
Position = UDim2.new(0.4,0,0.78,0)
}
local responseOutProperties = {
Position = UDim2.new(4,0,0.779,0)
}
local responseInProperties = {
Position = UDim2.new(0.863,0,0.779,0)
}
local dialogueInTween = tweenServ:Create(dialogueBox, dialogueInTweenInfo, dialogueInProperties)
local dialogueOutTween = tweenServ:Create(dialogueBox, dialogueOutTweenInfo, dialogueOutProperties)
local responseInTween = tweenServ:Create(reponseBox, responseInTweenInfo, responseInProperties)
local ResponseOutTween = tweenServ:Create(reponseBox, responseOutTweenInfo, responseOutProperties)
local npcEvent = repStorage.npcTriggered
----------------------------------------------
local isTalking = false
npcEvent.OnClientEvent:Connect(function(npc)
print("successfully received request from "..plr.Name.." to talk to "..npc.Name)
if isTalking == false then
print("opening dialogue")
dialogueInTween:Play()
responseInTween:Play()
wait(1)
isTalking = true
elseif isTalking == true then
print("closing dialogue")
dialogueOutTween:Play()
ResponseOutTween:Play()
wait(1)
isTalking = false
end
end)