i wanted to do a interaction system with the door but it just didnt work, i dont know why, the Event doesn’t fire, It doesn’t even prints a thing on the console
Script located on a part named “knob” (It doesn’t even prints the “WAZAA”)
task.wait(0.1)
local basepart = script.Parent
local replicated = game:GetService("ReplicatedStorage")
local remoteinteract = basepart:WaitForChild("RemoteInteractable")
local doorsceneBoolean = workspace:WaitForChild("DoorCanOpenScene1")
local BlindableEventsFolder = workspace:WaitForChild("BlindableEvents")
local BlindableEventdoorScene1Event = BlindableEventsFolder:WaitForChild("doorscene1event")
local cooldown = false
remoteinteract.OnServerEvent:Connect(function()
print("WAZAAAAAAAAAA")
--if doorsceneBoolean.Value then
-- if not cooldown then
-- cooldown = true;
-- print("WAZAAA1")
-- BlindableEventdoorScene1Event:Fire()
-- end
--end
end)
My interaction client script located on startercharacterScripts (works)
task.wait(.1)
local tweenService = game:GetService("TweenService")
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local rootpart = char:WaitForChild("HumanoidRootPart")
local mouse = player:GetMouse()
local uis = game:GetService("UserInputService")
local runservice = game:GetService("RunService")
local guiE = script:WaitForChild("uiinteract")
local selectionbox = script:WaitForChild("wazabox")
local theclone
local textofclone
local frame
local selectbox
local isOnCamera = false
local distance = 8.2
local tInfo1 = TweenInfo.new(0.4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)
repeat
wait()
until _G.CustomMouse
local customMouse = _G.CustomMouse
local hit, pos -- predefine
runservice.Heartbeat:Connect(function()
hit, pos = customMouse.getTarget(distance, {player.Character, workspace.Baseplate}, true)
-- set hit,pos globally
-- if not hit or not pos then
-- return
-- end
-- You can't return if not hit due to your check later in the code
-- see [A] comment below
--if not uis.TouchEnabled then
if not player.PlayerGui:FindFirstChild("uiinteract") then
-- Make sure it's actually interactable.
if not isOnCamera and hit and hit:FindFirstChild("_Interactable") then
isOnCamera = true
theclone = guiE:Clone()
theclone.Parent = player.PlayerGui
frame = theclone:WaitForChild("Frame")
textofclone = frame:WaitForChild("E")
if hit:IsA("BasePart") then
selectbox = selectionbox:Clone()
selectbox.Parent = hit
selectbox.Adornee = hit
end
if uis.TouchEnabled then
textofclone.Text = "Click To Interact"
end
local t = tweenService:Create(textofclone, tInfo1, {TextTransparency = 0, TextStrokeTransparency = 0, Position = UDim2.new(-0, 0,0.099, 0)})
t:Play()
end
else
-- [A] this never had a chance to execute before
if not hit or (hit and not hit:FindFirstChild("_Interactable")) then
-- no need for ~= nil, Instances are "truthy"
-- they evaluate as "true" for conditionals.
if theclone and textofclone then
if isOnCamera then
if selectbox then
selectbox:Destroy()
end
local t = tweenService:Create(textofclone, tInfo1, {TextTransparency = 0, TextStrokeTransparency = 0, Position = UDim2.new(-0, 0,0.967, 0)})
t:Play()
t.Completed:Connect(function()
theclone:Destroy()
end)
-- theclone:Destroy()
isOnCamera = false
end
end
end
-- end
end
-- Don't connect things in a Heartbeat unless you know what
-- you're doing.
end)
uis.InputBegan:Connect(function(inputObject, gameProcessEvent)
if gameProcessEvent then
return
end
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
if hit and hit:FindFirstChild("_Interactable") then
local remote = hit:WaitForChild("RemoteInteractable")
remote:FireServer()
print("click mousedone2")
end
end
end)
uis.InputBegan:Connect(function(inputObject, gameProcessEvent)
if gameProcessEvent then
return
end
if uis.TouchEnabled then
if hit and hit:FindFirstChild("_Interactable") then
local remote = hit:WaitForChild("RemoteInteractable")
remote:FireServer()
end
end
end)