Hello, my fellas dev,
I’m trying to make a math simulator game without resources or a tutorial. Which mean that I’m having a lot of issue and problem at the same time. My script doesn’t work and I don’t know why. Maybe you can help?
Script(Interact)
--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")
--//Variables
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Bindables = ReplicatedStorage:WaitForChild("Bindables")
local model = script.Parent
local pad = model.Pad
local cameraBone = model.CameraBone
local attachmentPart = model.AttachmentPart
--//Functions
local function onTrigger(player)
Remotes:WaitForChild("toggleCameraScene"):FireClient(player, 1, {CFrame = cameraBone.CFrame}, true)
Remotes:WaitForChild("togglePadGui"):FireClient(player, true)
end
--//Run functions
attachmentPart.Prompt.Triggered:Connect(function(player)
if player then
onTrigger(player)
end
end)
LocalScript(InteractClient)
--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")
--//Variables
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Bindables = ReplicatedStorage:WaitForChild("Bindables")
local model = script.Parent
local pad = model.Pad
local cameraBone = model
local attachmentPart = model.AttachmentPart
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character
--//Functions
local function CreateTweenAnimation(duration, properties)
local info = TweenInfo.new(
duration,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut
)
local tween = TweenService:Create(cameraBone,info,properties)
print("A")
return tween
end
--//Run functions
Remotes:WaitForChild("toggleCameraScene").OnClientEvent:Connect(function(duration, properties, visible)
if visible then
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = model.CameraBone
local tween = CreateTweenAnimation(duration, properties)
tween:Play()
tween.Completed:Wait()
print("true")
else
print("false")
end
end)
If you want more detail or info, just reply to this post. Thank you.
Cheers,
UncleDev